… | |
… | |
501 | |
501 | |
502 | =item $guard = mon $port |
502 | =item $guard = mon $port |
503 | |
503 | |
504 | =item $guard = mon $port, $rcvport, @msg |
504 | =item $guard = mon $port, $rcvport, @msg |
505 | |
505 | |
506 | Monitor the given port and do something when the port is killed, and |
506 | Monitor the given port and do something when the port is killed or |
507 | optionally return a guard that can be used to stop monitoring again. |
507 | messages to it were lost, and optionally return a guard that can be used |
|
|
508 | to stop monitoring again. |
|
|
509 | |
|
|
510 | C<mon> effectively guarantees that, in the absence of hardware failures, |
|
|
511 | that after starting the monitor, either all messages sent to the port |
|
|
512 | will arrive, or the monitoring action will be invoked after possible |
|
|
513 | message loss has been detected. No messages will be lost "in between" |
|
|
514 | (after the first lost message no further messages will be received by the |
|
|
515 | port). After the monitoring action was invoked, further messages might get |
|
|
516 | delivered again. |
508 | |
517 | |
509 | In the first form (callback), the callback is simply called with any |
518 | In the first form (callback), the callback is simply called with any |
510 | number of C<@reason> elements (no @reason means that the port was deleted |
519 | number of C<@reason> elements (no @reason means that the port was deleted |
511 | "normally"). Note also that I<< the callback B<must> never die >>, so use |
520 | "normally"). Note also that I<< the callback B<must> never die >>, so use |
512 | C<eval> if unsure. |
521 | C<eval> if unsure. |