… | |
… | |
227 | with a coroutine. |
227 | with a coroutine. |
228 | |
228 | |
229 | This method simply sets the "$coroutine->{desc}" member to the given |
229 | This method simply sets the "$coroutine->{desc}" member to the given |
230 | string. You can modify this member directly if you wish. |
230 | string. You can modify this member directly if you wish. |
231 | |
231 | |
|
|
232 | $coroutine->throw ([$scalar]) |
|
|
233 | If $throw is specified and defined, it will be thrown as an |
|
|
234 | exception inside the coroutine at the next convinient point in time |
|
|
235 | (usually after it gains control at the next schedule/transfer/cede). |
|
|
236 | Otherwise clears the exception object. |
|
|
237 | |
|
|
238 | The exception object will be thrown "as is" with the specified |
|
|
239 | scalar in $@, i.e. if it is a string, no line number or newline will |
|
|
240 | be appended (unlike with "die"). |
|
|
241 | |
|
|
242 | This can be used as a softer means than "cancel" to ask a coroutine |
|
|
243 | to end itself, although there is no guarentee that the exception |
|
|
244 | will lead to termination, and if the exception isn't caught it might |
|
|
245 | well end the whole program. |
|
|
246 | |
232 | GLOBAL FUNCTIONS |
247 | GLOBAL FUNCTIONS |
233 | Coro::nready |
248 | Coro::nready |
234 | Returns the number of coroutines that are currently in the ready |
249 | Returns the number of coroutines that are currently in the ready |
235 | state, i.e. that can be switched to. The value 0 means that the only |
250 | state, i.e. that can be switched to. The value 0 means that the only |
236 | runnable coroutine is the currently running one, so "cede" would |
251 | runnable coroutine is the currently running one, so "cede" would |