… | |
… | |
22 | # blocking is safe in your own threads |
22 | # blocking is safe in your own threads |
23 | ... |
23 | ... |
24 | }; |
24 | }; |
25 | |
25 | |
26 | =head1 DESCRIPTION |
26 | =head1 DESCRIPTION |
27 | |
|
|
28 | EXPERIMENTAL WARNING: This module is in its early stages of |
|
|
29 | development. It's fine to try out, but it didn't receive the normal amount |
|
|
30 | of testing and real-world usage that my other modules have gone through. |
|
|
31 | |
27 | |
32 | While L<Coro> threads (unlike ithreads) provide real threads similar to |
28 | While L<Coro> threads (unlike ithreads) provide real threads similar to |
33 | pthreads, python threads and so on, they do not run in parallel to each |
29 | pthreads, python threads and so on, they do not run in parallel to each |
34 | other even on machines with multiple CPUs or multiple CPU cores. |
30 | other even on machines with multiple CPUs or multiple CPU cores. |
35 | |
31 | |
… | |
… | |
80 | deadlock. |
76 | deadlock. |
81 | |
77 | |
82 | =head2 USE IT IN THE MAIN PROGRAM |
78 | =head2 USE IT IN THE MAIN PROGRAM |
83 | |
79 | |
84 | One way to avoid this is to not run perlmulticore enabled functions |
80 | One way to avoid this is to not run perlmulticore enabled functions |
85 | in any callbacks. A simpler way to snure it works is to disable |
81 | in any callbacks. A simpler way to ensure it works is to disable |
86 | C<Coro::Multicore> thread switching in event loop callbacks, and enable it |
82 | C<Coro::Multicore> thread switching in event loop callbacks, and enable it |
87 | everywhere else. |
83 | everywhere else. |
88 | |
84 | |
89 | Therefore, if you control the event loop, as is usually the case when |
85 | Therefore, if you control the event loop, as is usually the case when |
90 | you write I<program> and not a I<module>, then you can enable C<Coro::Multicore> |
86 | you write I<program> and not a I<module>, then you can enable C<Coro::Multicore> |