… | |
… | |
141 | |
141 | |
142 | # the next line destroys the _coro_state, but keeps the |
142 | # the next line destroys the _coro_state, but keeps the |
143 | # process itself intact (we basically make it a zombie |
143 | # process itself intact (we basically make it a zombie |
144 | # process that always runs the manager thread, so it's possible |
144 | # process that always runs the manager thread, so it's possible |
145 | # to transfer() to this process). |
145 | # to transfer() to this process). |
146 | $coro->{_coro_state} = $manager->{_coro_state}; |
146 | $coro->{_coro_state}->_clone_state_from ($manager->{_coro_state}); |
147 | } |
147 | } |
148 | &schedule; |
148 | &schedule; |
149 | } |
149 | } |
150 | }; |
150 | }; |
151 | |
151 | |
… | |
… | |
274 | &schedule; |
274 | &schedule; |
275 | } |
275 | } |
276 | wantarray ? @{$self->{status}} : $self->{status}[0]; |
276 | wantarray ? @{$self->{status}} : $self->{status}[0]; |
277 | } |
277 | } |
278 | |
278 | |
279 | =item $oldprio = $process->prio($newprio) |
279 | =item $oldprio = $process->prio ($newprio) |
280 | |
280 | |
281 | Sets (or gets, if the argument is missing) the priority of the |
281 | Sets (or gets, if the argument is missing) the priority of the |
282 | process. Higher priority processes get run before lower priority |
282 | process. Higher priority processes get run before lower priority |
283 | processes. Priorities are small signed integers (currently -4 .. +3), |
283 | processes. Priorities are small signed integers (currently -4 .. +3), |
284 | that you can refer to using PRIO_xxx constants (use the import tag :prio |
284 | that you can refer to using PRIO_xxx constants (use the import tag :prio |
… | |
… | |
299 | process). This is a bug that will be fixed in some future version. |
299 | process). This is a bug that will be fixed in some future version. |
300 | |
300 | |
301 | =cut |
301 | =cut |
302 | |
302 | |
303 | sub prio { |
303 | sub prio { |
304 | my $old = $_[0]{prio}; |
304 | shift->{_coro_state}->prio (@_) |
305 | $_[0]{prio} = $_[1] if @_ > 1; |
|
|
306 | $old; |
|
|
307 | } |
305 | } |
308 | |
306 | |
309 | =item $newprio = $process->nice($change) |
307 | =item $newprio = $process->nice ($change) |
310 | |
308 | |
311 | Similar to C<prio>, but subtract the given value from the priority (i.e. |
309 | Similar to C<prio>, but subtract the given value from the priority (i.e. |
312 | higher values mean lower priority, just as in unix). |
310 | higher values mean lower priority, just as in unix). |
313 | |
311 | |
314 | =cut |
312 | =cut |
315 | |
313 | |
316 | sub nice { |
314 | sub nice { |
317 | $_[0]{prio} -= $_[1]; |
315 | shift->{_coro_state}->nice (@_) |
318 | } |
316 | } |
319 | |
317 | |
320 | =item $olddesc = $process->desc($newdesc) |
318 | =item $olddesc = $process->desc ($newdesc) |
321 | |
319 | |
322 | Sets (or gets in case the argument is missing) the description for this |
320 | Sets (or gets in case the argument is missing) the description for this |
323 | process. This is just a free-form string you can associate with a process. |
321 | process. This is just a free-form string you can associate with a process. |
324 | |
322 | |
325 | =cut |
323 | =cut |