Skip to content
Newer
Older
100644 552 lines (362 sloc) 14.1 KB
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
1 /*
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
2 Copyright (C) 2001-2010, Parrot Foundation.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
3 $Id$
4
5 =head1 NAME
6
7 src/pmc/scheduler.pmc - The concurrency scheduler
8
9 =head1 DESCRIPTION
10
11 Implements the core concurrency scheduler.
12
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
13 =head2 Vtable Functions
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
14
15 =over 4
16
17 =cut
18
19 */
20
ec73fb3 @allisonrandal [concurrency] Divide scheduler headers into public and private (for c…
allisonrandal authored Dec 6, 2007
21 #include "parrot/scheduler_private.h"
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
22
6bdd5f9 @petdance headerizer now runs on PMC files
petdance authored Mar 28, 2010
23 /* HEADERIZER HFILE: none */
24 /* HEADERIZER BEGIN: static */
25 /* HEADERIZER END: static */
26
6b81760 @Whiteknight [pmc] we don't need need_ext anymore, so BALEETED
Whiteknight authored Aug 23, 2009
27 pmclass Scheduler auto_attrs {
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
28
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
29 ATTR INTVAL id; /* The scheduler's ID. */
30 ATTR INTVAL max_tid; /* The highest assigned task ID. */
31 ATTR INTVAL pending; /* A count of pending tasks (cached for fast
32 lookup). */
33 ATTR PMC *task_list; /* The current list of tasks. */
34 ATTR PMC *task_index; /* An index into the current list of tasks,
35 ordered by priority. */
36 ATTR PMC *wait_index; /* An unordered index of inactive tasks. */
37 ATTR PMC *handlers; /* The list of currently active handlers. */
38 ATTR PMC *messages; /* A message queue used for communication
39 between schedulers. */
40 ATTR Parrot_mutex msg_lock; /* Lock to synchronize the message queue. */
41 ATTR Parrot_Interp interp; /* A link to the scheduler's interpreter. */
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
42
43 /*
44
45 =item C<void init()>
46
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
47 Initializes a concurrency scheduler object.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
48
49 =cut
50
51 */
52
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
53 VTABLE void init() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
54 Parrot_Scheduler_attributes * const core_struct =
5a7584e @NotFound merge auto_attrs branch into trunk
NotFound authored Aug 18, 2009
55 (Parrot_Scheduler_attributes *) PMC_data(SELF);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
56
1997c49 @cotto [gc] remove/replace DOD references in core PMCs
cotto authored Feb 12, 2009
57 /* Set flags for custom GC mark and destroy. */
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
58 PObj_custom_mark_SET(SELF);
4591dbb @chromatic [HLL] Fixed two compilation-breaking typos accidentally committed in …
chromatic authored Sep 3, 2009
59 PObj_custom_destroy_SET(SELF);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
60
61 /* Set up the core struct. */
62 core_struct->id = 0;
63 core_struct->max_tid = 0;
083213a @Whiteknight start rename of pmc_new to Parrot_pmc_new
Whiteknight authored Feb 16, 2010
64 core_struct->task_list = Parrot_pmc_new(interp, enum_class_Hash);
65 core_struct->task_index = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
66 core_struct->wait_index = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
67 core_struct->handlers = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
68 core_struct->messages = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
2f43c23 @allisonrandal [concurrency] Initialize interp struct member in Scheduler. Add a way to
allisonrandal authored Dec 2, 2007
69 core_struct->interp = INTERP;
4d9c960 @allisonrandal [concurrency] Next stage of concurrency implementation, message passi…
allisonrandal authored Jan 5, 2008
70 MUTEX_INIT(core_struct->msg_lock);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
71 }
72
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
73
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
74 /*
75
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
76 =item C<void init_pmc(PMC *data)>
77
78 Initializes a new Scheduler with a C<Hash> PMC with any or all of the keys:
79
80 =over 4
81
82 =item C<id>
83
84 An C<Integer> representing the unique identifier for this scheduler.
85
86 =back
87
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
88 =cut
89
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
90 */
91
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
92 VTABLE void init_pmc(PMC *data) {
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
93 PMC *elem;
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
94 Parrot_Scheduler_attributes *core_struct;
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
95
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
96 if (!VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Hash")))
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
97 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
4d9c960 @allisonrandal [concurrency] Next stage of concurrency implementation, message passi…
allisonrandal authored Jan 5, 2008
98 "Scheduler initializer must be a Hash");
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
99
4d9c960 @allisonrandal [concurrency] Next stage of concurrency implementation, message passi…
allisonrandal authored Jan 5, 2008
100 SELF.init();
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
101
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
102 core_struct = PARROT_SCHEDULER(SELF);
103 elem = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "id"));
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
104
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
105 if (!PMC_IS_NULL(elem))
106 core_struct->id = VTABLE_get_integer(INTERP, elem);
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
107 }
108
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
109
96858ee @chromatic [PMC] Added init_pmc() to Scheduler PMC, with tests.
chromatic authored Dec 3, 2007
110 /*
111
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
112 =item C<void push_pmc(PMC *value)>
113
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
114 Inserts a task into the task list, giving it a task ID one higher than the
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
115 current maximum, and a birthtime of the current time.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
116
117 =cut
118
119 */
120
e922116 @allisonrandal [concurrency] Initial implementation of concurrency scheduler runloop.
allisonrandal authored Dec 4, 2007
121 void push_pmc(PMC *task) {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
122 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
123 STRING *task_id_str;
124 INTVAL new_tid;
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
125
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
126 task = VTABLE_share_ro(INTERP, task);
127 VTABLE_set_number_native(INTERP, task, Parrot_floatval_time());
d0fb13e @allisonrandal [concurrency] Tasks are marked as shared before being inserted into t…
allisonrandal authored Dec 6, 2007
128
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
129 new_tid = ++(core_struct->max_tid);
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
130 VTABLE_set_integer_native(INTERP, task, new_tid);
b6bc0c3 @allisonrandal [pdd28str] Merging the pdd27mmd branch into trunk for r36123 to r36318.
allisonrandal authored Feb 3, 2009
131 task_id_str = Parrot_str_from_int(INTERP, new_tid);
245b0a8 @allisonrandal [concurrency] Change an array of task IDs to an integer array rather …
allisonrandal authored Dec 6, 2007
132
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
133 VTABLE_set_pmc_keyed_str(INTERP, core_struct->task_list,
134 task_id_str, task);
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
135
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
136 if (task->vtable->base_type == enum_class_Timer)
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
137 VTABLE_push_integer(INTERP, core_struct->wait_index, new_tid);
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
138 else
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
139 VTABLE_push_integer(INTERP, core_struct->task_index, new_tid);
140
141 SCHEDULER_cache_valid_CLEAR(SELF);
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
142
143 if (task->vtable->base_type != enum_class_Exception)
144 Parrot_cx_runloop_wake(core_struct->interp, SELF);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
145 }
146
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
147
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
148 /*
149
150 =item C<PMC *pop_pmc()>
151
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
152 Retrieves the next task from the task list. If the task index is invalid,
153 recalculates it before retrieving the next task.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
154
155 =cut
156
157 */
158
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
159 VTABLE PMC *pop_pmc() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
160 Parrot_Scheduler_attributes * core_struct = PARROT_SCHEDULER(SELF);
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
161 PMC *task = PMCNULL;
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
162
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
163 /* Pull the next valid task off the task list, skipping expired and
164 * deleted tasks. */
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
165 while (PMC_IS_NULL(task)
166 && VTABLE_elements(INTERP, core_struct->task_index) > 0) {
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
167 const INTVAL tid = VTABLE_shift_integer(INTERP, core_struct->task_index);
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
168
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
169 if (tid > 0)
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
170 task = VTABLE_get_pmc_keyed_int(INTERP,
171 core_struct->task_list, tid);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
172 }
173
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
174 return task;
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
175 }
176
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
177
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
178 /*
179
2f43c23 @allisonrandal [concurrency] Initialize interp struct member in Scheduler. Add a way to
allisonrandal authored Dec 2, 2007
180 =item C<INTVAL get_integer()>
181
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
182 Retrieves the number of pending tasks in the scheduler's task list.
2f43c23 @allisonrandal [concurrency] Initialize interp struct member in Scheduler. Add a way to
allisonrandal authored Dec 2, 2007
183
184 =cut
185
186 */
187
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
188 VTABLE INTVAL get_integer() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
189 Parrot_Scheduler_attributes * core_struct = PARROT_SCHEDULER(SELF);
2f43c23 @allisonrandal [concurrency] Initialize interp struct member in Scheduler. Add a way to
allisonrandal authored Dec 2, 2007
190 return VTABLE_elements(INTERP, core_struct->task_index);
191 }
192
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
193
2f43c23 @allisonrandal [concurrency] Initialize interp struct member in Scheduler. Add a way to
allisonrandal authored Dec 2, 2007
194 /*
195
196 =item C<void delete_keyed_int(INTVAL key)>
197
198 Removes the task with the given task ID from the task list.
199
200 =cut
201
202 */
203
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
204 VTABLE void delete_keyed_int(INTVAL key) {
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
205 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
206 STRING * const task_id_str = Parrot_str_from_int(INTERP, key);
207
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
208 VTABLE_delete_keyed_str(INTERP, core_struct->task_list, task_id_str);
2f43c23 @allisonrandal [concurrency] Initialize interp struct member in Scheduler. Add a way to
allisonrandal authored Dec 2, 2007
209 SCHEDULER_cache_valid_CLEAR(SELF);
210 }
211
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
212
2f43c23 @allisonrandal [concurrency] Initialize interp struct member in Scheduler. Add a way to
allisonrandal authored Dec 2, 2007
213 /*
214
e922116 @allisonrandal [concurrency] Initial implementation of concurrency scheduler runloop.
allisonrandal authored Dec 4, 2007
215 =item C<PMC *share_ro()>
216
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
217 Sets this PMC as shared.
e922116 @allisonrandal [concurrency] Initial implementation of concurrency scheduler runloop.
allisonrandal authored Dec 4, 2007
218
219 =cut
220
221 */
222
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
223 VTABLE PMC *share_ro() {
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
224 PMC *shared_self;
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
225 Parrot_Scheduler_attributes *sched;
e922116 @allisonrandal [concurrency] Initial implementation of concurrency scheduler runloop.
allisonrandal authored Dec 4, 2007
226
227 if (PObj_is_PMC_shared_TEST(SELF))
228 return SELF;
229
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
230 shared_self = pt_shared_fixup(INTERP, SELF);
231 sched = PARROT_SCHEDULER(shared_self);
e922116 @allisonrandal [concurrency] Initial implementation of concurrency scheduler runloop.
allisonrandal authored Dec 4, 2007
232
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
233 sched->task_list = pt_shared_fixup(INTERP, sched->task_list);
234 sched->task_index = pt_shared_fixup(INTERP, sched->task_index);
235 sched->wait_index = pt_shared_fixup(INTERP, sched->wait_index);
236 sched->handlers = pt_shared_fixup(INTERP, sched->handlers);
237 sched->messages = pt_shared_fixup(INTERP, sched->messages);
e922116 @allisonrandal [concurrency] Initial implementation of concurrency scheduler runloop.
allisonrandal authored Dec 4, 2007
238
239 return shared_self;
240 }
241
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
242
e922116 @allisonrandal [concurrency] Initial implementation of concurrency scheduler runloop.
allisonrandal authored Dec 4, 2007
243 /*
244
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
245 =item C<void destroy()>
246
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
247 Frees the scheduler's underlying struct.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
248
249 =cut
250
251 */
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
252 VTABLE void destroy() {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
253 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
540d4c3 @bacek Merge context_pmc3 branch into trunk.
bacek authored Sep 3, 2009
254 /* TT #946: this line is causing an order-of-destruction error
255 because the scheduler is being freed before it's tasks.
256 Commenting this out till we get a real fix (although it's a hack) */
257 /* MUTEX_DESTROY(core_struct->msg_lock); */
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
258 }
259
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
260
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
261 /*
262
263 =item C<void mark()>
264
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
265 Marks any referenced strings and PMCs as live.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
266
267 =cut
268
269 */
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
270 VTABLE void mark() {
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
271 if (PARROT_SCHEDULER(SELF)) {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
272 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
273
18dd147 @NotFound [gc] add new mark_... _alive functions, use it in a lot of mark vtabl…
NotFound authored Sep 24, 2009
274 Parrot_gc_mark_PMC_alive(interp, core_struct->task_list);
275 Parrot_gc_mark_PMC_alive(interp, core_struct->task_index);
276 Parrot_gc_mark_PMC_alive(interp, core_struct->wait_index);
277 Parrot_gc_mark_PMC_alive(interp, core_struct->handlers);
278 Parrot_gc_mark_PMC_alive(interp, core_struct->messages);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
279 }
280 }
281
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
282
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
283 /*
284
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
285 =item C<void visit(PMC *info)>
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
286
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
287 Visits the contents of the scheduler (used by freeze/thaw).
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
288
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
289 C<*info> is the visit info (see F<include/parrot/pmc_freeze.h>).
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
290
291 =cut
292
293 */
294
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
295 VTABLE void visit(PMC *info) {
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
296 /* 1) visit task list */
4c43475 @plobsing merge branch pmc_freeze_cleanup
plobsing authored Jan 13, 2010
297 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, task_list);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
298
299 /* 2) visit the handlers */
4c43475 @plobsing merge branch pmc_freeze_cleanup
plobsing authored Jan 13, 2010
300 VISIT_PMC_ATTR(INTERP, info, SELF, Scheduler, handlers);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
301 }
302
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
303
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
304 /*
305
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
306 =item C<void freeze(PMC *info)>
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
307
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
308 Archives the scheduler.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
309
310 =cut
311
312 */
313
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
314 VTABLE void freeze(PMC *info) {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
315 Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
316
317 /* 1) freeze scheduler id */
4c43475 @plobsing merge branch pmc_freeze_cleanup
plobsing authored Jan 13, 2010
318 VTABLE_push_integer(INTERP, info, core_struct->id);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
319
320 /* 2) freeze maximum task id */
4c43475 @plobsing merge branch pmc_freeze_cleanup
plobsing authored Jan 13, 2010
321 VTABLE_push_integer(INTERP, info, core_struct->max_tid);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
322 }
323
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
324
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
325 /*
326
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
327 =item C<void thaw(PMC *info)>
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
328
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
329 Unarchives the scheduler.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
330
331 =cut
332
333 */
334
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
335 VTABLE void thaw(PMC *info) {
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
336 /* 1. thaw scheduler id */
4c43475 @plobsing merge branch pmc_freeze_cleanup
plobsing authored Jan 13, 2010
337 const INTVAL id = VTABLE_shift_integer(INTERP, info);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
338
339 /* 2. thaw maximum task id */
4c43475 @plobsing merge branch pmc_freeze_cleanup
plobsing authored Jan 13, 2010
340 const INTVAL max_tid = VTABLE_shift_integer(INTERP, info);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
341
342 /* Allocate the scheduler's core data struct and set custom flags. */
343 SELF.init();
344
345 /* Set the scheduler's id to the frozen id */
346 PARROT_SCHEDULER(SELF)->id = id;
347
348 /* Set the scheduler's maximum task id to the frozen tid */
349 PARROT_SCHEDULER(SELF)->max_tid = max_tid;
350 }
351
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
352
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
353 /*
354
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
355 =item C<void thawfinish(PMC *info)>
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
356
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
357 Finishes thawing the scheduler.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
358
359 =cut
360
361 */
362
b101f2c @darbelo Merge pmc_freeze_with_pmcs into trunk.
darbelo authored Feb 2, 2010
363 VTABLE void thawfinish(PMC *info) {
4d9c960 @allisonrandal [concurrency] Next stage of concurrency implementation, message passi…
allisonrandal authored Jan 5, 2008
364 Parrot_cx_refresh_task_list(INTERP, SELF);
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
365 }
366
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
367
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
368 /*
369
370 =back
371
372 =head2 Methods
373
374 =over 4
375
376 =cut
377
378 */
379
380 /*
381
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
382 =item C<METHOD add_handler(PMC *handler)>
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
383
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
384 Adds a handler to the scheduler.
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
385
386 =cut
387
388 */
389
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
390 METHOD add_handler(PMC *handler) {
971e997 @NotFound rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
NotFound authored Sep 8, 2008
391 Parrot_Scheduler_attributes *core_struct = PARROT_SCHEDULER(SELF);
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
392 VTABLE_unshift_pmc(INTERP, core_struct->handlers, handler);
393 }
394
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
395
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
396 /*
397
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
398 =item C<METHOD delete_handler(STRING *type :optional, INTVAL have_type :opt_flag)>
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
399
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
400 Deletes a handler from the scheduler.
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
401
402 =cut
403
404 */
405
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
406 METHOD delete_handler(STRING *type :optional, INTVAL have_type :opt_flag) {
407 PMC *handlers;
408 INTVAL elements, index;
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
409 STRING * const except_str = CONST_STRING(INTERP, "exception");
410 STRING * const event_str = CONST_STRING(INTERP, "event");
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
411
412 GET_ATTR_handlers(INTERP, SELF, handlers);
413 elements = VTABLE_elements(INTERP, handlers);
414
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
415 if (!have_type)
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
416 VTABLE_shift_pmc(INTERP, handlers);
417
418 /* Loop from newest handler to oldest handler. */
419 for (index = 0; index < elements; ++index) {
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
420 const PMC * const handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
421 if (!PMC_IS_NULL(handler)) {
4b380b1 @Util [cage] (TT #397) PDD07 enforcement for Parrot_str_not_equal(foo,bar)==0
Util authored Mar 3, 2009
422 if (Parrot_str_equal(INTERP, type, except_str)
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
423 && handler->vtable->base_type == enum_class_ExceptionHandler) {
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
424 VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
425 RETURN(void);
426 }
4b380b1 @Util [cage] (TT #397) PDD07 enforcement for Parrot_str_not_equal(foo,bar)==0
Util authored Mar 3, 2009
427 else if (Parrot_str_equal(INTERP, type, event_str)
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
428 && handler->vtable->base_type == enum_class_EventHandler) {
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
429 VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
430 RETURN(void);
431 }
432 }
433 }
434
435 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
436 "No handler to delete.");
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
437 }
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
438
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
439
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
440 /*
441
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
442 =item C<METHOD find_handler(PMC *task)>
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
443
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
444 Searchs for a handler for the given task. If no handler is found, returns
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
445 PMCNULL.
446
447 =cut
448
449 */
450
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
451 METHOD find_handler(PMC *task) {
0006ce7 @chromatic [src] Fixed all CONST_STRING macros so that they don't break across l…
chromatic authored Dec 19, 2008
452 STRING * const handled_str = CONST_STRING(interp, "handled");
453 STRING * const iter_str = CONST_STRING(interp, "handler_iter");
454 PMC *iter;
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
455
456 /* Exceptions store the handler iterator for rethrow, other kinds of
457 * tasks don't (though they could). */
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
458 if (task->vtable->base_type == enum_class_Exception
0006ce7 @chromatic [src] Fixed all CONST_STRING macros so that they don't break across l…
chromatic authored Dec 19, 2008
459 && VTABLE_get_integer_keyed_str(interp, task, handled_str) == -1) {
460 iter = VTABLE_get_attr_str(interp, task, iter_str);
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
461 }
462 else {
463 PMC *handlers;
464 GET_ATTR_handlers(interp, SELF, handlers);
465 iter = VTABLE_get_iter(interp, handlers);
466
467 if (task->vtable->base_type == enum_class_Exception)
0006ce7 @chromatic [src] Fixed all CONST_STRING macros so that they don't break across l…
chromatic authored Dec 19, 2008
468 VTABLE_set_attr_str(interp, task, iter_str, iter);
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
469 }
470
471 /* Loop from newest handler to oldest handler. */
472 while (VTABLE_get_bool(interp, iter)) {
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
473 PMC * const handler = VTABLE_shift_pmc(INTERP, iter);
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
474
475 INTVAL valid_handler = 0;
476 if (!PMC_IS_NULL(handler)) {
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
477 (const INTVAL valid_handler) = PCCINVOKE(INTERP, handler, "can_handle", PMC *task);
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
478 if (valid_handler) {
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
479 if (task->vtable->base_type == enum_class_Exception)
480 VTABLE_set_integer_native(interp, handler, 1);
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
481 RETURN(PMC *handler);
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
482 }
483 }
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
484
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
485 }
486
59661f1 @allisonrandal [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
allisonrandal authored Mar 11, 2008
487 RETURN(PMC *PMCNULL);
98ca8df @allisonrandal [concurrency] Further work on the new concurrency scheduler. (With ap…
allisonrandal authored Dec 31, 2007
488 }
489
d6808fe @allisonrandal [events] Add interface for event handling, add subtype attribute to t…
allisonrandal authored Dec 12, 2007
490
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
491 /*
492
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
493 =item C<METHOD count_handlers(STRING *type :optional, INTVAL have_type :opt_flag)>
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
494
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
495 Returns the number of handlers currently held by the scheduler. If a type
496 argument is passed, only counts handlers of that type (C<event>, C<exception>).
497 If no type argument is passed, counts all handlers.
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
498
499 =cut
500
501 */
502
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
503 METHOD count_handlers(STRING *type :optional, INTVAL have_type :opt_flag) {
504 /* avoid uninitialized value warning */
505 PMC *handlers = NULL;
9f26f43 @NotFound fix count_eh opcode and add test for it, TT #212 rg++
NotFound authored Jan 25, 2009
506 INTVAL elements;
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
507 INTVAL count = 0;
508 INTVAL index;
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
509
510 GET_ATTR_handlers(INTERP, SELF, handlers);
9f26f43 @NotFound fix count_eh opcode and add test for it, TT #212 rg++
NotFound authored Jan 25, 2009
511 elements = VTABLE_elements(INTERP, handlers);
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
512
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
513 if (!have_type)
514 RETURN(INTVAL elements);
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
515
516 for (index = 0; index < elements; ++index) {
ab0dec3 @petdance consting
petdance authored Mar 18, 2010
517 const PMC * const handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
518 STRING * const exception = CONST_STRING(INTERP, "exception");
519 STRING * const event = CONST_STRING(INTERP, "event");
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
520
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
521 if (!PMC_IS_NULL(handler)) {
4b380b1 @Util [cage] (TT #397) PDD07 enforcement for Parrot_str_not_equal(foo,bar)==0
Util authored Mar 3, 2009
522 if ((Parrot_str_equal(INTERP, type, exception)
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
523 && handler->vtable->base_type == enum_class_ExceptionHandler)
4b380b1 @Util [cage] (TT #397) PDD07 enforcement for Parrot_str_not_equal(foo,bar)==0
Util authored Mar 3, 2009
524 || (Parrot_str_equal(INTERP, type, event)
be7602b @chromatic [PMC] Fixed compiler warnings (use of uninitialized variables) and ti…
chromatic authored Aug 9, 2008
525 && handler->vtable->base_type == enum_class_EventHandler))
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
526 count++;
527 }
528 }
529
530 RETURN(INTVAL count);
531 }
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
532 }
533
534 /*
535
536 =back
537
538 =head1 SEE ALSO
539
4d9c960 @allisonrandal [concurrency] Next stage of concurrency implementation, message passi…
allisonrandal authored Jan 5, 2008
540 F<docs/pdds/pdd25_concurrency.pod>.
1d259c6 @allisonrandal [concurrency] Initial implementations of the Scheduler and Task PMCs.
allisonrandal authored Nov 25, 2007
541
542 =cut
543
544 */
545
546 /*
547 * Local variables:
548 * c-file-style: "parrot"
549 * End:
550 * vim: expandtab shiftwidth=4:
551 */
Something went wrong with that request. Please try again.