ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-Fork-RPC/RPC.pm
(Generate patch)

Comparing AnyEvent-Fork-RPC/RPC.pm (file contents):
Revision 1.14 by root, Thu Apr 18 13:11:12 2013 UTC vs.
Revision 1.16 by root, Thu Apr 18 14:07:15 2013 UTC

11 ->new 11 ->new
12 ->require ("MyModule") 12 ->require ("MyModule")
13 ->AnyEvent::Fork::RPC::run ( 13 ->AnyEvent::Fork::RPC::run (
14 "MyModule::server", 14 "MyModule::server",
15 ); 15 );
16
17 use AnyEvent;
16 18
17 my $cv = AE::cv; 19 my $cv = AE::cv;
18 20
19 $rpc->(1, 2, 3, sub { 21 $rpc->(1, 2, 3, sub {
20 print "MyModule::server returned @_\n"; 22 print "MyModule::server returned @_\n";
372 374
373The default server used in the child does all I/O blockingly, and only 375The default server used in the child does all I/O blockingly, and only
374allows a single RPC call to execute concurrently. 376allows a single RPC call to execute concurrently.
375 377
376Setting C<async> to a true value switches to another implementation that 378Setting C<async> to a true value switches to another implementation that
377uses L<AnyEvent> in the child and allows multiple concurrent RPC calls. 379uses L<AnyEvent> in the child and allows multiple concurrent RPC calls (it
380does not support recursion in the event loop however, blocking condvar
381calls will fail).
378 382
379The actual API in the child is documented in the section that describes 383The actual API in the child is documented in the section that describes
380the calling semantics of the returned C<$rpc> function. 384the calling semantics of the returned C<$rpc> function.
381 385
382If you want to pre-load the actual back-end modules to enable memory 386If you want to pre-load the actual back-end modules to enable memory
693are queued and the jobs are slow, they will all run concurrently. The 697are queued and the jobs are slow, they will all run concurrently. The
694child must implement some queueing/limiting mechanism if this causes 698child must implement some queueing/limiting mechanism if this causes
695problems. Alternatively, the parent could limit the amount of rpc calls 699problems. Alternatively, the parent could limit the amount of rpc calls
696that are outstanding. 700that are outstanding.
697 701
702Blocking use of condvars is not supported.
703
698Using event-based modules such as L<IO::AIO>, L<Gtk2>, L<Tk> and so on is 704Using event-based modules such as L<IO::AIO>, L<Gtk2>, L<Tk> and so on is
699easy. 705easy.
700 706
701=back 707=back
702 708
765so you might want to look into L<AnyEvent::FDpasser> which can handle the 771so you might want to look into L<AnyEvent::FDpasser> which can handle the
766gory details. 772gory details.
767 773
768=head1 SEE ALSO 774=head1 SEE ALSO
769 775
770L<AnyEvent::Fork> (to create the processes in the first place), 776L<AnyEvent::Fork>, to create the processes in the first place.
777
771L<AnyEvent::Fork::Pool> (to manage whole pools of processes). 778L<AnyEvent::Fork::Pool>, to manage whole pools of processes.
772 779
773=head1 AUTHOR AND CONTACT INFORMATION 780=head1 AUTHOR AND CONTACT INFORMATION
774 781
775 Marc Lehmann <schmorp@schmorp.de> 782 Marc Lehmann <schmorp@schmorp.de>
776 http://software.schmorp.de/pkg/AnyEvent-Fork-RPC 783 http://software.schmorp.de/pkg/AnyEvent-Fork-RPC

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines