Skip to content
This repository
Newer
Older
100644 378 lines (235 sloc) 8.458 kb
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
1 /*
c1411da5 » rurban
2012-12-10 [cage] mark and document unused parameters as such
2 Copyright (C) 2001-2012, 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 {
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
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
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
32 ATTR PMC *task_queue; /* List of tasks/green threads waiting to run */
33 ATTR PMC *foreign_tasks; /* List of tasks/green threads waiting to run */
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
34 ATTR Parrot_mutex task_queue_lock;
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
35 ATTR PMC *alarms; /* List of future alarms ordered by time */
fb0dfd8a » NatTuck
2010-06-30 Progress on alarms / timers.
36
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
37 ATTR PMC *all_tasks; /* Hash of all active tasks by ID */
38 ATTR UINTVAL next_task_id; /* ID to assign to the next created task */
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
39
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
40 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.
41
42 /*
43
44 =item C<void init()>
45
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
46 Initializes a concurrency scheduler object.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
47
48 =cut
49
50 */
51
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
52 VTABLE void init() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
53 Parrot_Scheduler_attributes * const core_struct =
5a7584e8 » NotFound
2009-08-18 merge auto_attrs branch into trunk
54 (Parrot_Scheduler_attributes *) PMC_data(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
55
1997c49c » cotto
2009-02-12 [gc] remove/replace DOD references in core PMCs
56 /* Set flags for custom GC mark and destroy. */
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
57 PObj_custom_mark_SET(SELF);
4591dbb8 » chromatic
2009-09-03 [HLL] Fixed two compilation-breaking typos accidentally committed in …
58 PObj_custom_destroy_SET(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
59
60 /* Set up the core struct. */
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
61 core_struct->id = 0;
33a45e38 » Whiteknight
2012-08-09 A few small cleanups to scheduler and schedulermessage PMCs. No funct…
62 core_struct->next_task_id = 0;
63 core_struct->interp = INTERP;
64
65 /* TODO: Do we need to eagerly create all these PMCs, or can we create
66 them lazily on demand? */
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
67 core_struct->handlers = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
68 core_struct->messages = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
69 core_struct->task_queue = Parrot_pmc_new(INTERP, enum_class_PMCList);
65e27042 » niner
2012-03-25 Fix the wait op for threads
70 core_struct->foreign_tasks = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
71 core_struct->alarms = Parrot_pmc_new(INTERP, enum_class_PMCList);
72 core_struct->all_tasks = Parrot_pmc_new(INTERP, enum_class_Hash);
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
73
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
74 MUTEX_INIT(core_struct->task_queue_lock);
75
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
76 /* Chandon TODO: Delete from int-keyed hash doesn't like me. */
77 /* VTABLE_set_integer_native(interp, core_struct->all_tasks, Hash_key_type_int); */
78
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
79 }
80
81 /*
82
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
83 =item C<void init_pmc(PMC *data)>
84
85 Initializes a new Scheduler with a C<Hash> PMC with any or all of the keys:
86
87 =over 4
88
89 =item C<id>
90
91 An C<Integer> representing the unique identifier for this scheduler.
92
93 =back
94
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
95 =cut
96
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
97 */
98
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
99 VTABLE void init_pmc(PMC *data) {
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
100 PMC *elem;
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
101 Parrot_Scheduler_attributes *core_struct;
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
102
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
103 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.
104 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
4d9c9604 » allisonrandal
2008-01-05 [concurrency] Next stage of concurrency implementation, message passi…
105 "Scheduler initializer must be a Hash");
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
106
4d9c9604 » allisonrandal
2008-01-05 [concurrency] Next stage of concurrency implementation, message passi…
107 SELF.init();
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
108
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
109 core_struct = PARROT_SCHEDULER(SELF);
110 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.
111
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
112 if (!PMC_IS_NULL(elem))
113 core_struct->id = VTABLE_get_integer(INTERP, elem);
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
114 }
115
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
116
96858eea » chromatic
2007-12-03 [PMC] Added init_pmc() to Scheduler PMC, with tests.
117 /*
118
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
119 =item C<void push_pmc(PMC *value)>
120
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
121 Inserts a task into the task list.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
122
123 =cut
124
125 */
126
e9221160 » allisonrandal
2007-12-04 [concurrency] Initial implementation of concurrency scheduler runloop.
127 void push_pmc(PMC *task) {
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);
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
129
130 LOCK(core_struct->task_queue_lock);
131 VTABLE_push_pmc(INTERP, core_struct->task_queue, task);
132 UNLOCK(core_struct->task_queue_lock);
133 }
134
135
136 /*
137
138 =item C<void unshift_pmc(PMC *value)>
139
140 Inserts a task into the head of the task list.
141
142 =cut
143
144 */
145
146 void unshift_pmc(PMC *task) {
147 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
148
149 LOCK(core_struct->task_queue_lock);
150 VTABLE_unshift_pmc(INTERP, core_struct->task_queue, task);
151 UNLOCK(core_struct->task_queue_lock);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
152 }
153
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
154
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
155 /*
156
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
157 =item C<PMC *shift_pmc()>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
158
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
159 Retrieves the next task from the task list.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
160
161 =cut
162
163 */
164
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
165 VTABLE PMC *shift_pmc() {
9ddac318 » Whiteknight
2011-10-28 cleanup Scheduler.pmc and Task.pmc. Add const for the optimizer. Fix …
166 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
167 PMC * task;
168
169 LOCK(core_struct->task_queue_lock);
170 task = VTABLE_shift_pmc(INTERP, core_struct->task_queue);
171 UNLOCK(core_struct->task_queue_lock);
172
98ca8df8 » allisonrandal
2007-12-31 [concurrency] Further work on the new concurrency scheduler. (With ap…
173 return task;
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
174 }
175
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
176
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
177 /*
178
2f43c232 » allisonrandal
2007-12-02 [concurrency] Initialize interp struct member in Scheduler. Add a way to
179 =item C<INTVAL get_integer()>
180
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
181 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
182
183 =cut
184
185 */
186
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
187 VTABLE INTVAL get_integer() {
fd1a8003 » petdance
2011-10-18 removed unused var task_id_str. Consted a pointer, and marked an inte…
188 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
04717aef » niner
2011-11-12 Move all access to task_queue to scheduler.pmc and protect by a lock
189 INTVAL elements;
190
191 LOCK(core_struct->task_queue_lock);
192 elements = VTABLE_elements(INTERP, PARROT_SCHEDULER(SELF)->task_queue);
193 UNLOCK(core_struct->task_queue_lock);
194
195 return elements;
e9221160 » allisonrandal
2007-12-04 [concurrency] Initial implementation of concurrency scheduler runloop.
196 }
197
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
198
e9221160 » allisonrandal
2007-12-04 [concurrency] Initial implementation of concurrency scheduler runloop.
199 /*
200
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
201 =item C<void destroy()>
202
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
203 Frees the scheduler's underlying struct.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
204
205 =cut
206
207 */
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
208 VTABLE void destroy() {
847cb9bc » rurban
2012-09-24 [GH #836] Cleaned wrong UNUSED(arg) macros in all pmc's
209 UNUSED(INTERP)
97eac131 » rurban
2012-12-11 [cage] Add remaining missing UNUSED(arg) declarations from pmc
210 UNUSED(SELF)
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
211 }
212
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
213
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
214 /*
215
216 =item C<void mark()>
217
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
218 Marks any referenced strings and PMCs as live.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
219
220 =cut
221
222 */
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
223 VTABLE void mark() {
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
224 if (PARROT_SCHEDULER(SELF)) {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
225 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
226
26914e12 » Jimmy Zhuo
2010-05-05 changed interp in pmc class to INTERP for unification
227 Parrot_gc_mark_PMC_alive(INTERP, core_struct->handlers);
228 Parrot_gc_mark_PMC_alive(INTERP, core_struct->messages);
9f3e20df » NatTuck
2010-07-01 [gsoc_threads] Alarms work, at least the easy way.
229 Parrot_gc_mark_PMC_alive(INTERP, core_struct->task_queue);
f29b2419 » niner
2012-03-02 Keep a list of foreign tasks
230 Parrot_gc_mark_PMC_alive(INTERP, core_struct->foreign_tasks);
9f3e20df » NatTuck
2010-07-01 [gsoc_threads] Alarms work, at least the easy way.
231 Parrot_gc_mark_PMC_alive(INTERP, core_struct->alarms);
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
232 Parrot_gc_mark_PMC_alive(INTERP, core_struct->all_tasks);
5d8728ec » NatTuck
2010-07-02 [gsoc_threads] Fix some failing tests.
233 }
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
234 }
235
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
236
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
237 /*
238
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
239 =item C<void visit(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
240
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
241 Visits the contents of the scheduler (used by freeze/thaw).
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
242
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
243 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.
244
245 =cut
246
247 */
248
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
249 VTABLE void visit(PMC *info) {
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
250 /* 1) visit task list */
62b52c92 » NatTuck
2010-07-04 [gsoc_threads] Added callback PMC to handle NCI.
251 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, task_queue);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
252
253 /* 2) visit the handlers */
4c434759 » plobsing
2010-01-13 merge branch pmc_freeze_cleanup
254 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, handlers);
62b52c92 » NatTuck
2010-07-04 [gsoc_threads] Added callback PMC to handle NCI.
255
256 /* 3) visit the alarms */
257 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, alarms);
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
258
259 /* 3) visit all tasks */
260 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, all_tasks);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
261 }
262
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
263
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
264 /*
265
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
266 =item C<void freeze(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
267
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
268 Archives the scheduler.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
269
270 =cut
271
272 */
273
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
274 VTABLE void freeze(PMC *info) {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
275 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
276
277 /* 1) freeze scheduler id */
4c434759 » plobsing
2010-01-13 merge branch pmc_freeze_cleanup
278 VTABLE_push_integer(INTERP, info, core_struct->id);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
279 }
280
281 /*
282
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
283 =item C<void thaw(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
284
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
285 Unarchives the scheduler.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
286
287 =cut
288
289 */
290
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
291 VTABLE void thaw(PMC *info) {
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
292 /* 1. thaw scheduler id */
4c434759 » plobsing
2010-01-13 merge branch pmc_freeze_cleanup
293 const INTVAL id = VTABLE_shift_integer(INTERP, info);
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
294
295 /* Allocate the scheduler's core data struct and set custom flags. */
296 SELF.init();
297
298 /* Set the scheduler's id to the frozen id */
299 PARROT_SCHEDULER(SELF)->id = id;
300 }
301
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
302
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
303 /*
304
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
305 =item C<void thawfinish(PMC *info)>
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
306
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
307 Finishes thawing the scheduler.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
308
309 =cut
310
311 */
312
b101f2ca » darbelo
2010-02-02 Merge pmc_freeze_with_pmcs into trunk.
313 VTABLE void thawfinish(PMC *info) {
c1411da5 » rurban
2012-12-10 [cage] mark and document unused parameters as such
314 UNUSED(INTERP)
315 UNUSED(SELF)
97eac131 » rurban
2012-12-11 [cage] Add remaining missing UNUSED(arg) declarations from pmc
316 UNUSED(info)
317 /* Parrot_cx_refresh_task_list(INTERP, SELF); */
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
318 }
319
be7602b4 » chromatic
2008-08-09 [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
320
d6808fe8 » allisonrandal
2007-12-12 [events] Add interface for event handling, add subtype attribute to t…
321 /*
322
323 =back
324
325 =head2 Methods
326
327 =over 4
328
329 =cut
330
331 */
332
333 /*
334
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
335 =item C<METHOD active_tasks()>
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
336
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
337 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.
338
339 =cut
340
341 */
342
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
343 METHOD active_tasks() {
344 Parrot_Scheduler_attributes *sdata = PARROT_SCHEDULER(SELF);
847cb9bc » rurban
2012-09-24 [GH #836] Cleaned wrong UNUSED(arg) macros in all pmc's
345 PMC * const tasks = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
346 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.
347
847cb9bc » rurban
2012-09-24 [GH #836] Cleaned wrong UNUSED(arg) macros in all pmc's
348 while (!VTABLE_get_bool(INTERP, iter)) {
349 PMC * const pair = VTABLE_shift_pmc(INTERP, iter);
9ddac318 » Whiteknight
2011-10-28 cleanup Scheduler.pmc and Task.pmc. Add const for the optimizer. Fix …
350 PMC * task = PMCNULL;
847cb9bc » rurban
2012-09-24 [GH #836] Cleaned wrong UNUSED(arg) macros in all pmc's
351 STRING * const value = CONST_STRING(INTERP, "value");
352 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 …
353 value, "->P", &task);
847cb9bc » rurban
2012-09-24 [GH #836] Cleaned wrong UNUSED(arg) macros in all pmc's
354 VTABLE_push_pmc(INTERP, tasks, task);
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
355 }
356
9110bb80 » NatTuck
2010-07-21 [gsoc_threads] More green threads API.
357 RETURN(PMC* tasks);
2255840f » allisonrandal
2008-08-02 [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
358 }
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
359 }
360
361 /*
362
363 =back
364
365 =head1 SEE ALSO
366
4d9c9604 » allisonrandal
2008-01-05 [concurrency] Next stage of concurrency implementation, message passi…
367 F<docs/pdds/pdd25_concurrency.pod>.
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
368
369 =cut
370
371 */
372
373 /*
374 * Local variables:
375 * c-file-style: "parrot"
376 * End:
1d7dded8 » plobsing
2010-11-29 update C file vim modelines
377 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
1d259c67 » allisonrandal
2007-11-25 [concurrency] Initial implementations of the Scheduler and Task PMCs.
378 */
Something went wrong with that request. Please try again.