Skip to content
This repository
Newer
Older
100644 345 lines (216 sloc) 7.957 kb
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
1 /*
3f0c0084 » NotFound
2011-09-07 use a hash keyed by int in Schecduler task_list to avoid string-int c…
2 Copyright (C) 2001-2011, Parrot Foundation.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
3
4 =head1 NAME
5
6 src/pmc/scheduler.pmc - The concurrency scheduler
7
8 =head1 DESCRIPTION
9
10 Implements the core concurrency scheduler.
11
d6808fe8 » allisonrandal
2007-12-12 [events] Add interface for event handling, add subtype attribute to t…
12 =head2 Vtable Functions
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
13
14 =over 4
15
16 =cut
17
18 */
19
ec73fb31 » allisonrandal
2007-12-06 [concurrency] Divide scheduler headers into public and private (for c…
20 #include "parrot/scheduler_private.h"
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
21
6bdd5f99 » petdance
2010-03-28 headerizer now runs on PMC files
22 /* HEADERIZER HFILE: none */
23 /* HEADERIZER BEGIN: static */
24 /* HEADERIZER END: static */
25
6b817608 » Whiteknight
2009-08-23 [pmc] we don't need need_ext anymore, so BALEETED
26 pmclass Scheduler auto_attrs {
fb0dfd8a » NatTuck
2010-06-30 Progress on alarms / timers.
27 ATTR INTVAL id; /* The scheduler's ID. */
28 ATTR PMC *handlers; /* The list of currently active handlers. */
29 ATTR PMC *messages; /* A message queue used for communication
30 between schedulers. */
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
31
9f3e20df » NatTuck
2010-07-01 [gsoc_threads] Alarms work, at least the easy way.
32 ATTR PMC *task_queue; /* List of tasks/green threads waiting to run */
33 ATTR PMC *alarms; /* List of future alarms ordered by time */
fb0dfd8a » NatTuck
2010-06-30 Progress on alarms / timers.
34
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
35 ATTR PMC *all_tasks; /* Hash of all active tasks by ID */
36 ATTR UINTVAL next_task_id; /* ID to assign to the next created task */
e6fa7fc8 » Whiteknight
2011-10-29 rename enable_event_checking -> Parrot_runcore_enable_event_checking,…
37 ATTR INTVAL enable_preemption;
38 /* Can perform uncooperative task preemption */
39 ATTR INTVAL enable_scheduling;
40 /* Can perform task scheduling behaviors */
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
41
fb0dfd8a » NatTuck
2010-06-30 Progress on alarms / timers.
42 ATTR Parrot_Interp interp; /* A link to the scheduler's interpreter. */
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
43
44 /*
45
46 =item C<void init()>
47
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
48 Initializes a concurrency scheduler object.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
49
50 =cut
51
52 */
53
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
54 VTABLE void init() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
55 Parrot_Scheduler_attributes * const core_struct =
5a7584e8 » NotFound
2009-08-18 merge auto_attrs branch into trunk
56 (Parrot_Scheduler_attributes *) PMC_data(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
57
1997c49c » cotto
2009-02-12 [gc] remove/replace DOD references in core PMCs
58 /* Set flags for custom GC mark and destroy. */
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
59 PObj_custom_mark_SET(SELF);
4591dbb8 » chromatic
2009-09-03 [HLL] Fixed two compilation-breaking typos accidentally committed in …
60 PObj_custom_destroy_SET(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
61
62 /* Set up the core struct. */
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
63 core_struct->id = 0;
64 core_struct->handlers = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
65 core_struct->messages = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
66 core_struct->task_queue = Parrot_pmc_new(INTERP, enum_class_PMCList);
67 core_struct->alarms = Parrot_pmc_new(INTERP, enum_class_PMCList);
68 core_struct->all_tasks = Parrot_pmc_new(INTERP, enum_class_Hash);
e6fa7fc8 » Whiteknight
2011-10-29 rename enable_event_checking -> Parrot_runcore_enable_event_checking,…
69 core_struct->enable_scheduling = 0;
70 core_struct->enable_preemption = 0;
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
71 core_struct->next_task_id = 0;
72 core_struct->interp = INTERP;
73
74 /* Chandon TODO: Delete from int-keyed hash doesn't like me. */
75 /* VTABLE_set_integer_native(interp, core_struct->all_tasks, Hash_key_type_int); */
76
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
77 }
78
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
79
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
80 /*
81
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
82 =item C<void init_pmc(PMC *data)>
83
84 Initializes a new Scheduler with a C<Hash> PMC with any or all of the keys:
85
86 =over 4
87
88 =item C<id>
89
90 An C<Integer> representing the unique identifier for this scheduler.
91
92 =back
93
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
94 =cut
95
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
96 */
97
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
98 VTABLE void init_pmc(PMC *data) {
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
99 PMC *elem;
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
100 Parrot_Scheduler_attributes *core_struct;
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
101
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
102 if (!VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Hash")))
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
103 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
4d9c9604 » allisonrandal
2008-01-05 [concurrency] Next stage of concurrency implementation, message passi…
104 "Scheduler initializer must be a Hash");
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
105
4d9c9604 » allisonrandal
2008-01-05 [concurrency] Next stage of concurrency implementation, message passi…
106 SELF.init();
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
107
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
108 core_struct = PARROT_SCHEDULER(SELF);
109 elem = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "id"));
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
110
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
111 if (!PMC_IS_NULL(elem))
112 core_struct->id = VTABLE_get_integer(INTERP, elem);
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
113 }
114
115 /*
116
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
117 =item C<void push_pmc(PMC *value)>
118
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
119 Inserts a task into the task list, giving it a task ID one higher than the
98ca8df8 » allisonrandal
2007-12-31 [concurrency] Further work on the new concurrency scheduler. (With ap…
120 current maximum, and a birthtime of the current time.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
121
122 =cut
123
124 */
125
e9221160 » allisonrandal
2007-12-04 [concurrency] Initial implementation of concurrency scheduler runloop.
126 void push_pmc(PMC *task) {
3fe43f82 » Whiteknight
2011-10-26 Fix conflicts after merge to newest master
127 /* TODO: This doesn't appear to do anything */
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
128 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
9ddac318 » Whiteknight
2011-10-28 cleanup Scheduler.pmc and Task.pmc. Add const for the optimizer. Fix …
129 PMC * const type_pmc = VTABLE_get_attr_str(interp, task, CONST_STRING(interp, "type"));
130 STRING * const type = VTABLE_get_string(interp, type_pmc);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
131 }
132
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
133
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
134 /*
135
136 =item C<PMC *pop_pmc()>
137
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
138 Retrieves the next task from the task list. If the task index is invalid,
139 recalculates it before retrieving the next task.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
140
141 =cut
142
143 */
144
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
145 VTABLE PMC *pop_pmc() {
9ddac318 » Whiteknight
2011-10-28 cleanup Scheduler.pmc and Task.pmc. Add const for the optimizer. Fix …
146 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
147 PMC * const task = VTABLE_shift_pmc(INTERP, core_struct->task_queue);
98ca8df8 » allisonrandal
2007-12-31 [concurrency] Further work on the new concurrency scheduler. (With ap…
148 return task;
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
149 }
150
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
151
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
152 /*
153
2f43c232 » allisonrandal
2007-12-02 [concurrency] Initialize interp struct member in Scheduler. Add a way to
154 =item C<INTVAL get_integer()>
155
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
156 Retrieves the number of pending tasks in the scheduler's task list.
2f43c232 » allisonrandal
2007-12-02 [concurrency] Initialize interp struct member in Scheduler. Add a way to
157
158 =cut
159
160 */
161
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
162 VTABLE INTVAL get_integer() {
fd1a8003 » petdance
2011-10-18 removed unused var task_id_str. Consted a pointer, and marked an inte…
163 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
856f3b25 » niner
2011-09-25 Cleanup green_threads/kill_threads merge, builds now
164 return VTABLE_elements(INTERP, core_struct->task_queue);
e9221160 » allisonrandal
2007-12-04 [concurrency] Initial implementation of concurrency scheduler runloop.
165 }
166
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
167
e9221160 » allisonrandal
2007-12-04 [concurrency] Initial implementation of concurrency scheduler runloop.
168 /*
169
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
170 =item C<void destroy()>
171
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
172 Frees the scheduler's underlying struct.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
173
174 =cut
175
176 */
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
177 VTABLE void destroy() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
178 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
fd1a8003 » petdance
2011-10-18 removed unused var task_id_str. Consted a pointer, and marked an inte…
179 UNUSED(interp);
180
40787d49 » Whiteknight
2010-06-12 [gc] Gix order-of-destruction bug discovered by Chandon++. The check …
181 core_struct->interp->scheduler = NULL;
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
182 }
183
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
184
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
185 /*
186
187 =item C<void mark()>
188
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
189 Marks any referenced strings and PMCs as live.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
190
191 =cut
192
193 */
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
194 VTABLE void mark() {
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
195 if (PARROT_SCHEDULER(SELF)) {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
196 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
197
26914e12 » Jimmy Zhuo
2010-05-05 changed interp in pmc class to INTERP for unification
198 Parrot_gc_mark_PMC_alive(INTERP, core_struct->handlers);
199 Parrot_gc_mark_PMC_alive(INTERP, core_struct->messages);
9f3e20df » NatTuck
2010-07-01 [gsoc_threads] Alarms work, at least the easy way.
200 Parrot_gc_mark_PMC_alive(INTERP, core_struct->task_queue);
201 Parrot_gc_mark_PMC_alive(INTERP, core_struct->alarms);
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
202 Parrot_gc_mark_PMC_alive(INTERP, core_struct->all_tasks);
5d8728ec » NatTuck
2010-07-02 [gsoc_threads] Fix some failing tests.
203 }
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
204 }
205
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
206
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
207 /*
208
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
209 =item C<void visit(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
210
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
211 Visits the contents of the scheduler (used by freeze/thaw).
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
212
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
213 C<*info> is the visit info (see F<include/parrot/pmc_freeze.h>).
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
214
215 =cut
216
217 */
218
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
219 VTABLE void visit(PMC *info) {
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
220 /* 1) visit task list */
62b52c92 » NatTuck
2010-07-04 [gsoc_threads] Added callback PMC to handle NCI.
221 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, task_queue);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
222
223 /* 2) visit the handlers */
4c434759 » plobsing
2010-01-13 merge branch pmc_freeze_cleanup
224 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, handlers);
62b52c92 » NatTuck
2010-07-04 [gsoc_threads] Added callback PMC to handle NCI.
225
226 /* 3) visit the alarms */
227 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, alarms);
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
228
229 /* 3) visit all tasks */
230 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, all_tasks);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
231 }
232
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
233
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
234 /*
235
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
236 =item C<void freeze(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
237
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
238 Archives the scheduler.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
239
240 =cut
241
242 */
243
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
244 VTABLE void freeze(PMC *info) {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
245 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
246
247 /* 1) freeze scheduler id */
4c434759 » plobsing
2010-01-13 merge branch pmc_freeze_cleanup
248 VTABLE_push_integer(INTERP, info, core_struct->id);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
249 }
250
251 /*
252
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
253 =item C<void thaw(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
254
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
255 Unarchives the scheduler.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
256
257 =cut
258
259 */
260
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
261 VTABLE void thaw(PMC *info) {
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
262 /* 1. thaw scheduler id */
4c434759 » plobsing
2010-01-13 merge branch pmc_freeze_cleanup
263 const INTVAL id = VTABLE_shift_integer(INTERP, info);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
264
265 /* Allocate the scheduler's core data struct and set custom flags. */
266 SELF.init();
267
268 /* Set the scheduler's id to the frozen id */
269 PARROT_SCHEDULER(SELF)->id = id;
270 }
271
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
272
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
273 /*
274
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
275 =item C<void thawfinish(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
276
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
277 Finishes thawing the scheduler.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
278
279 =cut
280
281 */
282
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
283 VTABLE void thawfinish(PMC *info) {
5d8728ec » NatTuck
2010-07-02 [gsoc_threads] Fix some failing tests.
284 /* Parrot_cx_refresh_task_list(INTERP, SELF); */
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
285 }
286
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
287
d6808fe8 » allisonrandal
2007-12-12 [events] Add interface for event handling, add subtype attribute to t…
288 /*
289
290 =back
291
292 =head2 Methods
293
294 =over 4
295
296 =cut
297
298 */
299
300 /*
301
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
302 =item C<METHOD active_tasks()>
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
303
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
304 Returns a ResizablePMCArray containing pointers to all active tasks.
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
305
306 =cut
307
308 */
309
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
310 METHOD active_tasks() {
311 Parrot_Scheduler_attributes *sdata = PARROT_SCHEDULER(SELF);
9ddac318 » Whiteknight
2011-10-28 cleanup Scheduler.pmc and Task.pmc. Add const for the optimizer. Fix …
312 PMC * const tasks = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
313 PMC * const iter = Parrot_pmc_new_init(interp, enum_class_HashIterator, sdata->all_tasks);
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
314
315 while (!VTABLE_get_bool(interp, iter)) {
9ddac318 » Whiteknight
2011-10-28 cleanup Scheduler.pmc and Task.pmc. Add const for the optimizer. Fix …
316 PMC * const pair = VTABLE_shift_pmc(interp, iter);
317 PMC * task = PMCNULL;
318 STRING * const value = CONST_STRING(interp, "value");
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
319 Parrot_pcc_invoke_method_from_c_args(interp, pair,
9ddac318 » Whiteknight
2011-10-28 cleanup Scheduler.pmc and Task.pmc. Add const for the optimizer. Fix …
320 value, "->P", &task);
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
321 VTABLE_push_pmc(interp, tasks, task);
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
322 }
323
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
324 RETURN(PMC* tasks);
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
325 }
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
326 }
327
328 /*
329
330 =back
331
332 =head1 SEE ALSO
333
4d9c9604 » allisonrandal
2008-01-05 [concurrency] Next stage of concurrency implementation, message passi…
334 F<docs/pdds/pdd25_concurrency.pod>.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
335
336 =cut
337
338 */
339
340 /*
341 * Local variables:
342 * c-file-style: "parrot"
343 * End:
1d7dded8 » plobsing
2010-11-29 update C file vim modelines
344 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
345 */
Something went wrong with that request. Please try again.