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

Comparing AnyEvent-MP/MP.pm (file contents):
Revision 1.122 by root, Wed Feb 29 18:44:59 2012 UTC vs.
Revision 1.123 by root, Thu Mar 1 19:37:59 2012 UTC

82 82
83Ports are represented by (printable) strings called "port IDs". 83Ports are represented by (printable) strings called "port IDs".
84 84
85=item port ID - C<nodeid#portname> 85=item port ID - C<nodeid#portname>
86 86
87A port ID is the concatenation of a node ID, a hash-mark (C<#>) as 87A port ID is the concatenation of a node ID, a hash-mark (C<#>)
88separator, and a port name (a printable string of unspecified format). 88as separator, and a port name (a printable string of unspecified
89format created by AnyEvent::MP).
89 90
90=item node 91=item node
91 92
92A node is a single process containing at least one port - the node port, 93A node is a single process containing at least one port - the node port,
93which enables nodes to manage each other remotely, and to create new 94which enables nodes to manage each other remotely, and to create new
388sub _kilme { 389sub _kilme {
389 die "received message on port without callback"; 390 die "received message on port without callback";
390} 391}
391 392
392sub port(;&) { 393sub port(;&) {
393 my $id = "$UNIQ." . ++$ID; 394 my $id = $UNIQ . ++$ID;
394 my $port = "$NODE#$id"; 395 my $port = "$NODE#$id";
395 396
396 rcv $port, shift || \&_kilme; 397 rcv $port, shift || \&_kilme;
397 398
398 $port 399 $port
785} 786}
786 787
787sub spawn(@) { 788sub spawn(@) {
788 my ($nodeid, undef) = split /#/, shift, 2; 789 my ($nodeid, undef) = split /#/, shift, 2;
789 790
790 my $id = "$RUNIQ." . ++$ID; 791 my $id = $RUNIQ . ++$ID;
791 792
792 $_[0] =~ /::/ 793 $_[0] =~ /::/
793 or Carp::croak "spawn init function must be a fully-qualified name, caught"; 794 or Carp::croak "spawn init function must be a fully-qualified name, caught";
794 795
795 snd_to_func $nodeid, "AnyEvent::MP::_spawn" => $id, @_; 796 snd_to_func $nodeid, "AnyEvent::MP::_spawn" => $id, @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines