Coro::Signal - coroutine signals (binary semaphores)
use Coro::Signal; $sig = new Coro::Signal; $sig->wait; # wait for signal # ... some other "thread" $sig->send;
This module implements signal/binary semaphores/condition variables (basically all the same thing). You can wait for a signal to occur or send it, in which case it will wake up one waiter, or it can be broadcast, waking up all waiters.
Create a new signal.
Wait for the signal to occur. Returns immediately if the signal has been sent before.
Like wait, but returns false if no signal happens within $timeout seconds, otherwise true.
wait
Send the signal, waking up one waiting process or remember the signal if no process is waiting.
Send the signal, waking up all waiting process. If no process is waiting the signal is lost.
Return true when the signal is being awaited by some process.
Marc Lehmann <pcg@goof.com> http://www.goof.com/pcg/marc/
To install Coro, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Coro
CPAN shell
perl -MCPAN -e shell install Coro
For more information on module installation, please visit the detailed CPAN module installation guide.