… | |
… | |
2 | |
2 | |
3 | Coro::Multicore - make coro threads on multiple cores with specially supported modules |
3 | Coro::Multicore - make coro threads on multiple cores with specially supported modules |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use Coro::Multicore; |
7 | # when you DO control the main event loop, e.g. in the main program |
8 | |
8 | |
9 | # or, if you want it disabled by default (e.g. to use it from a module) |
9 | use Coro::Multicore; # enable by default |
10 | use Coro::Multicore (); |
10 | |
|
|
11 | Coro::Multicore::scoped_disable; |
|
|
12 | EV::loop; # or AnyEvent::Loop::run, Event::loop, AE::cv->recv, ... |
|
|
13 | |
|
|
14 | # when you DO NOT control the event loop, e.g. in a module on CPAN |
|
|
15 | |
|
|
16 | use Coro::Multicore (); # disable by default |
|
|
17 | |
|
|
18 | async { |
|
|
19 | Coro::Multicore::scoped_enable; |
|
|
20 | |
|
|
21 | # blocking is safe in your own threads |
|
|
22 | ... |
|
|
23 | }; |
11 | |
24 | |
12 | =head1 DESCRIPTION |
25 | =head1 DESCRIPTION |
13 | |
26 | |
14 | EXPERIMENTAL WARNING: This module is in its early stages of |
27 | EXPERIMENTAL WARNING: This module is in its early stages of |
15 | development. It's fine to try out, but it didn't receive the normal amount |
28 | development. It's fine to try out, but it didn't receive the normal amount |