… | |
… | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use Coro::Multicore; |
7 | use Coro::Multicore; |
8 | |
8 | |
9 | =head1 DESCRIPTION |
9 | =head1 DESCRIPTION |
|
|
10 | |
|
|
11 | While L<Coro> threads (unlike ithreads) provide real threads similar to |
|
|
12 | pthreads, python threads and so on, they do not run in parallel to eahc |
|
|
13 | other even on machines with multiple CPUs or multiple CPU cores. |
|
|
14 | |
|
|
15 | This module lifts this restriction under two very specific but useful |
|
|
16 | conditions: firstly, the coro thread executes in XS code and does not |
|
|
17 | touch any perl data structures, and secondly, the XS code is specially |
|
|
18 | prepared to allow this. |
|
|
19 | |
|
|
20 | This means that, when you call an XS function of a module prepared for it, |
|
|
21 | this XS function can execute in parallel to any other Coro threads. |
|
|
22 | |
|
|
23 | The mechanism to support this is easily added to existing modules and is |
|
|
24 | independent of L<Coro> or L<Coro::Multicore>, and therefore could be used, |
|
|
25 | without changes, with other, similar, modules, or even the perl core, |
|
|
26 | should it gain real thread support anytime soon. SEe L<TODO> for more info |
|
|
27 | on how to prepare a module to allow parallel execution. |
10 | |
28 | |
11 | =over 4 |
29 | =over 4 |
12 | |
30 | |
13 | =cut |
31 | =cut |
14 | |
32 | |