… | |
… | |
210 | |
210 | |
211 | This can be used to effectively disable this module's functionality |
211 | This can be used to effectively disable this module's functionality |
212 | by default, and enable it only for selected threads or scopes, by |
212 | by default, and enable it only for selected threads or scopes, by |
213 | calling "Coro::Multicore::scoped_enable". |
213 | calling "Coro::Multicore::scoped_enable". |
214 | |
214 | |
|
|
215 | Note that this setting nonly affects the *global default* - it will |
|
|
216 | not reflect whether multicore functionality is enabled for the |
|
|
217 | current thread. |
|
|
218 | |
215 | The function returns the previous value of the enable flag. |
219 | The function returns the previous value of the enable flag. |
216 | |
220 | |
217 | Coro::Multicore::scoped_enable |
221 | Coro::Multicore::scoped_enable |
218 | This function instructs Coro::Multicore to handle all requests |
222 | This function instructs Coro::Multicore to handle all requests |
219 | executed in the current coro thread, from the call to the end of the |
223 | executed in the current coro thread, from the call to the end of the |
… | |
… | |
325 | A workaround is to call "Coro::Multicore::enable 0" after a fork to |
329 | A workaround is to call "Coro::Multicore::enable 0" after a fork to |
326 | disable the module. |
330 | disable the module. |
327 | |
331 | |
328 | Future versions of this module might do this automatically. |
332 | Future versions of this module might do this automatically. |
329 | |
333 | |
330 | BUGS |
334 | BUGS & LIMITATIONS |
331 | (OS-) threads are never released |
335 | (OS-) threads are never released |
332 | At the moment, threads that were created once will never be freed. |
336 | At the moment, threads that were created once will never be freed. |
333 | They will be reused for asynchronous requests, though, so as long as |
337 | They will be reused for asynchronous requests, though, so as long as |
334 | you limit the maximum number of concurrent asynchronous tasks, this |
338 | you limit the maximum number of concurrent asynchronous tasks, this |
335 | will also limit the maximum number of threads created. |
339 | will also limit the maximum number of threads created. |
… | |
… | |
338 | GNU/Linux + glibc, each thread takes about 8KiB of userspace memory |
342 | GNU/Linux + glibc, each thread takes about 8KiB of userspace memory |
339 | + whatever the kernel needs (probably less than 8KiB). |
343 | + whatever the kernel needs (probably less than 8KiB). |
340 | |
344 | |
341 | Future versions will likely lift this limitation. |
345 | Future versions will likely lift this limitation. |
342 | |
346 | |
343 | AnyEvent is initalised at module load time |
347 | The enable_times feature of Coro is messed up |
344 | AnyEvent is initialised on module load, as opposed to at a later |
348 | The enable_times feature uses the per-thread timer to measure |
345 | time. |
349 | per-thread execution time, but since Coro::Multicore runs threads on |
|
|
350 | different pthreads it will get the wrong times. Real times are not |
|
|
351 | affected. |
346 | |
352 | |
347 | Future versions will likely change this. |
353 | Fork support |
|
|
354 | Due to the nature of threads, you are not allowed to use this module |
|
|
355 | in a forked child normally, with one exception: If you don't create |
|
|
356 | any threads in the parent, then it is safe to start using it in a |
|
|
357 | forked child. |
348 | |
358 | |
349 | AUTHOR |
359 | AUTHOR |
350 | Marc Lehmann <schmorp@schmorp.de> |
360 | Marc Lehmann <schmorp@schmorp.de> |
351 | http://software.schmorp.de/pkg/AnyEvent-XSThreadPool.html |
361 | http://software.schmorp.de/pkg/AnyEvent-XSThreadPool.html |
352 | |
362 | |
353 | Additional thanks to Zsbán Ambrus, who gave considerable desing input |
363 | Additional thanks to Zsbán Ambrus, who gave considerable desing input |
354 | for this module and the perl multicore specification. |
364 | for this module and the perl multicore specification. |
355 | |
365 | |