… | |
… | |
244 | =cut |
244 | =cut |
245 | |
245 | |
246 | package Coro::Multicore; |
246 | package Coro::Multicore; |
247 | |
247 | |
248 | use Coro (); |
248 | use Coro (); |
249 | use AnyEvent (); |
|
|
250 | |
249 | |
251 | BEGIN { |
250 | BEGIN { |
252 | our $VERSION = '1.03'; |
251 | our $VERSION = '1.04'; |
253 | |
252 | |
254 | use XSLoader; |
253 | use XSLoader; |
255 | XSLoader::load __PACKAGE__, $VERSION; |
254 | XSLoader::load __PACKAGE__, $VERSION; |
256 | } |
255 | } |
257 | |
256 | |
… | |
… | |
263 | } |
262 | } |
264 | |
263 | |
265 | enable 1; |
264 | enable 1; |
266 | } |
265 | } |
267 | |
266 | |
|
|
267 | our $WATCHER; |
|
|
268 | |
|
|
269 | # called when first thread is started, on first release. can |
|
|
270 | # be called manually, but is not currently a public interface. |
|
|
271 | sub init { |
|
|
272 | require AnyEvent; # maybe load it unconditionally? |
268 | our $WATCHER = AE::io fd, 0, \&poll; |
273 | $WATCHER ||= AE::io (fd, 0, \&poll); |
|
|
274 | } |
269 | |
275 | |
270 | =head1 THREAD SAFETY OF SUPPORTING XS MODULES |
276 | =head1 THREAD SAFETY OF SUPPORTING XS MODULES |
271 | |
277 | |
272 | Just because an XS module supports perlmulticore might not immediately |
278 | Just because an XS module supports perlmulticore might not immediately |
273 | make it reentrant. For example, while you can (try to) call C<execute> |
279 | make it reentrant. For example, while you can (try to) call C<execute> |