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

Comparing AnyEvent-MP/MP/Base.pm (file contents):
Revision 1.6 by root, Mon Aug 3 22:05:55 2009 UTC vs.
Revision 1.7 by root, Tue Aug 4 14:10:51 2009 UTC

31 31
32use base "Exporter"; 32use base "Exporter";
33 33
34our $VERSION = '0.01'; 34our $VERSION = '0.01';
35our @EXPORT = qw( 35our @EXPORT = qw(
36 NODE $NODE snd del _any_ 36 NODE $NODE snd kil _any_
37 become_slave become_public 37 become_slave become_public
38); 38);
39 39
40our $DEFAULT_SECRET; 40our $DEFAULT_SECRET;
41 41
143 143
144 ($NODE{$noderef} || add_node $noderef) 144 ($NODE{$noderef} || add_node $noderef)
145 ->send ([$port, @_]); 145 ->send ([$port, @_]);
146} 146}
147 147
148sub del($) { 148sub kil($) {
149 my ($noderef, $port) = split /#/, shift, 2; 149 my ($noderef, $port) = split /#/, shift, 2;
150 150
151 delete $PORT{$port}; 151 ($NODE{$noderef} || add_node $noderef)
152 152 ->kill ($port, @_);
153 my $mon = delete $LMON{$port}
154 or return;
155
156 $_->() for values %$mon;
157} 153}
158 154
159sub become_public { 155sub become_public {
160 return if $PUBLIC; 156 return if $PUBLIC;
161 157
196 }, 192 },
197 mon1 => sub { # enable monitoring 193 mon1 => sub { # enable monitoring
198 my $portid = shift; 194 my $portid = shift;
199 my $node = $SRCNODE; 195 my $node = $SRCNODE;
200 $NODE{""}->monitor ($portid, $node->{rmon}{$portid} = sub { 196 $NODE{""}->monitor ($portid, $node->{rmon}{$portid} = sub {
201 $node->send (["", exit => $portid]); 197 $node->send (["", kil => $portid]);
202 }); 198 });
203 }, 199 },
204 exit => sub { 200 kil => sub {
205 my $cbs = delete $SRCNODE->{lmon}{$_[0]} 201 my $cbs = delete $SRCNODE->{lmon}{$_[0]}
206 or return; 202 or return;
207 203
208 $_->() for @$cbs; 204 $_->() for @$cbs;
209 }, 205 },

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines