… | |
… | |
46 | This module uses processes created via L<AnyEvent::Fork> (or |
46 | This module uses processes created via L<AnyEvent::Fork> (or |
47 | L<AnyEvent::Fork::Remote>) and the RPC protocol implement in |
47 | L<AnyEvent::Fork::Remote>) and the RPC protocol implement in |
48 | L<AnyEvent::Fork::RPC> to create a load-balanced pool of processes that |
48 | L<AnyEvent::Fork::RPC> to create a load-balanced pool of processes that |
49 | handles jobs. |
49 | handles jobs. |
50 | |
50 | |
51 | Understanding of L<AnyEvent::Fork> is helpful but not critical to be able |
51 | Understanding L<AnyEvent::Fork> is helpful but not required to use this |
52 | to use this module, but a thorough understanding of L<AnyEvent::Fork::RPC> |
52 | module, but a thorough understanding of L<AnyEvent::Fork::RPC> is, as |
53 | is, as it defines the actual API that needs to be implemented in the |
53 | it defines the actual API that needs to be implemented in the worker |
54 | worker processes. |
54 | processes. |
55 | |
55 | |
56 | =head1 PARENT USAGE |
56 | =head1 PARENT USAGE |
57 | |
57 | |
58 | To create a pool, you first have to create a L<AnyEvent::Fork> object - |
58 | To create a pool, you first have to create a L<AnyEvent::Fork> object - |
59 | this object becomes your template process. Whenever a new worker process |
59 | this object becomes your template process. Whenever a new worker process |
… | |
… | |
94 | # in the hope of not colliding. yes, I don't like it either, |
94 | # in the hope of not colliding. yes, I don't like it either, |
95 | # but didn't come up with an obviously better alternative. |
95 | # but didn't come up with an obviously better alternative. |
96 | my $magic0 = ':t6Z@HK1N%Dx@_7?=~-7NQgWDdAs6a,jFN=wLO0*jD*1%P'; |
96 | my $magic0 = ':t6Z@HK1N%Dx@_7?=~-7NQgWDdAs6a,jFN=wLO0*jD*1%P'; |
97 | my $magic1 = '<~53rexz.U`!]X[A235^"fyEoiTF\T~oH1l/N6+Djep9b~bI9`\1x%B~vWO1q*'; |
97 | my $magic1 = '<~53rexz.U`!]X[A235^"fyEoiTF\T~oH1l/N6+Djep9b~bI9`\1x%B~vWO1q*'; |
98 | |
98 | |
99 | our $VERSION = 1.2; |
99 | our $VERSION = 1.3; |
100 | |
100 | |
101 | =item my $pool = AnyEvent::Fork::Pool::run $fork, $function, [key => value...] |
101 | =item my $pool = AnyEvent::Fork::Pool::run $fork, $function, [key => value...] |
102 | |
102 | |
103 | The traditional way to call the pool creation function. But it is way |
103 | The traditional way to call the pool creation function. But it is way |
104 | cooler to call it in the following way: |
104 | cooler to call it in the following way: |