… | |
… | |
237 | =cut |
237 | =cut |
238 | |
238 | |
239 | sub snd_to_func($$;@) { |
239 | sub snd_to_func($$;@) { |
240 | my $nodeid = shift; |
240 | my $nodeid = shift; |
241 | |
241 | |
242 | return ($NODE{$nodeid} || add_node $nodeid)->send (["", @_]) |
|
|
243 | if $nodeid ne $NODE; |
|
|
244 | |
|
|
245 | # on $NODE, we artificially delay... (for spawn) |
242 | # on $NODE, we artificially delay... (for spawn) |
246 | # this is very ugly - maybe we should simply delay ALL messages, |
243 | # this is very ugly - maybe we should simply delay ALL messages, |
247 | # to avoid deep recursion issues. but that's so... slow... |
244 | # to avoid deep recursion issues. but that's so... slow... |
248 | my @msg = ("", @_); |
245 | $AnyEvent::MP::Node::Self::DELAY = 1 |
249 | delay sub { $NODE{""}->send (\@msg) }; |
246 | if $nodeid ne $NODE; |
|
|
247 | |
|
|
248 | ($NODE{$nodeid} || add_node $nodeid)->send (["", @_]); |
250 | } |
249 | } |
251 | |
250 | |
252 | =item snd_on $node, @msg |
251 | =item snd_on $node, @msg |
253 | |
252 | |
254 | Executes C<snd> with the given C<@msg> (which must include the destination |
253 | Executes C<snd> with the given C<@msg> (which must include the destination |