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.17 by root, Thu Apr 18 20:04:51 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines