GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Signal(3) User Contributed Perl Documentation Signal(3)

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.

$sig = new Coro::Signal;
Create a new signal.
$sig->wait
Wait for the signal to occur (via either "send" or "broadcast"). Returns immediately if the signal has been sent before.
$sig->wait ($callback)
If you pass a callback argument to "wait", it will not wait, but immediately return. The callback will be called under the same conditions as "wait" without arguments would continue the thrad.

The callback might wake up any number of threads, but is NOT allowed to block (switch to other threads).

$sig->send
Send the signal, waking up one waiting process or remember the signal if no process is waiting.
$sig->broadcast
Send the signal, waking up all waiting process. If no process is waiting the signal is lost.
$sig->awaited
Return true when the signal is being awaited by some process.

   Marc A. Lehmann <schmorp@schmorp.de>
   http://software.schmorp.de/pkg/Coro.html
2020-07-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.