Signal(3pm) | User Contributed Perl Documentation | Signal(3pm) |
Coro::Signal - thread signals (binary semaphores)
use Coro; my $sig = new Coro::Signal; $sig->wait; # wait for signal # ... some other "thread" $sig->send;
This module implements signals/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.
It is recommended not to mix "send" and "broadcast" calls on the same "Coro::Signal" without some deep thinking: while it should work as documented, it can easily confuse you :->
You don't have to load "Coro::Signal" manually, it will be loaded automatically when you "use Coro" and call the "new" constructor.
The callback might wake up any number of threads, but is NOT allowed to block (switch to other threads).
Marc A. Lehmann <schmorp@schmorp.de> http://software.schmorp.de/pkg/Coro.html
2022-10-20 | perl v5.36.0 |