--- AnyEvent-MP/MP.pm 2009/09/11 02:32:23 1.87 +++ AnyEvent-MP/MP.pm 2009/10/02 20:41:56 1.100 @@ -1,6 +1,6 @@ =head1 NAME -AnyEvent::MP - multi-processing/message-passing framework +AnyEvent::MP - erlang-style multi-processing/message-passing framework =head1 SYNOPSIS @@ -33,19 +33,17 @@ my $port = spawn $node, $initfunc, @initdata; # monitoring - mon $port, $cb->(@msg) # callback is invoked on death - mon $port, $otherport # kill otherport on abnormal death - mon $port, $otherport, @msg # send message on death + mon $localport, $cb->(@msg) # callback is invoked on death + mon $localport, $otherport # kill otherport on abnormal death + mon $localport, $otherport, @msg # send message on death =head1 CURRENT STATUS bin/aemp - stable. AnyEvent::MP - stable API, should work. AnyEvent::MP::Intro - explains most concepts. - AnyEvent::MP::Kernel - mostly stable. - AnyEvent::MP::Global - stable but incomplete, protocol not yet final. - -stay tuned. + AnyEvent::MP::Kernel - mostly stable API. + AnyEvent::MP::Global - stable API. =head1 DESCRIPTION @@ -120,7 +118,7 @@ =item seeds - C Seeds are transport endpoint(s) (usually a hostname/IP address and a -TCP port) of nodes thta should be used as seed nodes. +TCP port) of nodes that should be used as seed nodes. The nodes listening on those endpoints are expected to be long-running, and at least one of those should always be available. When nodes run out @@ -147,12 +145,12 @@ use base "Exporter"; -our $VERSION = $AnyEvent::MP::Kernel::VERSION; +our $VERSION = 1.21; our @EXPORT = qw( NODE $NODE *SELF node_of after configure - snd rcv mon mon_guard kil reg psub spawn cal + snd rcv mon mon_guard kil psub spawn cal port ); @@ -527,7 +525,7 @@ Inter-host-connection timeouts and monitoring depend on the transport used. The only transport currently implemented is TCP, and AnyEvent::MP relies on TCP to detect node-downs (this can take 10-15 minutes on a -non-idle connection, and usually around two hours for idle conenctions). +non-idle connection, and usually around two hours for idle connections). This means that monitoring is good for program errors and cleaning up stuff eventually, but they are no replacement for a timeout when you need @@ -569,7 +567,7 @@ $node->monitor ($port, $cb); defined wantarray - and AnyEvent::Util::guard { $node->unmonitor ($port, $cb) } + and ($cb += 0, AnyEvent::Util::guard { $node->unmonitor ($port, $cb) }) } =item $guard = mon_guard $port, $ref, $ref... @@ -731,8 +729,8 @@ then the callback will be called without any arguments after the time-out elapsed and the port is Ced. -If no time-out is given, then the local port will monitor the remote port -instead, so it eventually gets cleaned-up. +If no time-out is given (or it is C), then the local port will +monitor the remote port instead, so it eventually gets cleaned-up. Currently this function returns the temporary port, but this "feature" might go in future versions unless you can make a convincing case that @@ -778,10 +776,10 @@ programming techniques employed by Erlang apply to AnyEvent::MP. Here is a sample: - http://www.Erlang.se/doc/programming_rules.shtml - http://Erlang.org/doc/getting_started/part_frame.html # chapters 3 and 4 - http://Erlang.org/download/Erlang-book-part1.pdf # chapters 5 and 6 - http://Erlang.org/download/armstrong_thesis_2003.pdf # chapters 4 and 5 + http://www.erlang.se/doc/programming_rules.shtml + http://erlang.org/doc/getting_started/part_frame.html # chapters 3 and 4 + http://erlang.org/download/erlang-book-part1.pdf # chapters 5 and 6 + http://erlang.org/download/armstrong_thesis_2003.pdf # chapters 4 and 5 Despite the similarities, there are also some important differences: @@ -791,7 +789,8 @@ Erlang relies on special naming and DNS to work everywhere in the same way. AEMP relies on each node somehow knowing its own address(es) (e.g. by -configuration or DNS), but will otherwise discover other odes itself. +configuration or DNS), and possibly the addresses of some seed nodes, but +will otherwise discover other nodes (and their IDs) itself. =item * Erlang has a "remote ports are like local ports" philosophy, AEMP uses "local ports are like remote ports". @@ -826,9 +825,9 @@ =item * Erlang suffers from silent message loss, AEMP does not. -Erlang makes few guarantees on messages delivery - messages can get lost -without any of the processes realising it (i.e. you send messages a, b, -and c, and the other side only receives messages a and c). +Erlang implements few guarantees on messages delivery - messages can get +lost without any of the processes realising it (i.e. you send messages a, +b, and c, and the other side only receives messages a and c). AEMP guarantees correct ordering, and the guarantee that after one message is lost, all following ones sent to the same port are lost as well, until