Signal(3pm) User Contributed Perl Documentation Signal(3pm)NAME
Coro::Signal - thread signals (binary semaphores)
SYNOPSIS
use Coro;
$sig = new Coro::Signal;
$sig->wait; # wait for signal
# ... some other "thread"
$sig->send;
DESCRIPTION
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" - it should work as documented, but 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.
$sem->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.
AUTHOR
Marc Lehmann <schmorp@schmorp.de>
http://home.schmorp.de/
perl v5.14.2 2012-04-13 Signal(3pm)
Check Out this Related Man Page
pthread_kill(3T)pthread_kill(3T)NAME
pthread_kill() - send a signal to a thread
SYNOPSIS PARAMETERS
thread Thread to which the signal is to be delivered.
sig Signal to be delivered to thread.
DESCRIPTION
The function is used to request that a signal be delivered to thread. The signal is asynchronously directed to thread in the calling
process. The signal is handled in the context of the given thread; if the signal action results in the thread terminating or stopping, this
action is applied to the whole process.
If sig is zero, error checking is performed but a signal is not sent.
RETURN VALUE
Upon successful completion, returns zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the function returns the corresponding error number:
[EINVAL] sig is an invalid or unsupported signal number.
[ESRCH] No thread could be found corresponding to thread.
AUTHOR
was derived from the IEEE POSIX P1003.1c standard.
SEE ALSO kill(2), sigaction(2), pthread_self(3T), raise(2).
STANDARDS CONFORMANCE
Pthread Library pthread_kill(3T)
Looking for a document that indicates the signal values and what they mean. Found this of AIX under /usr/include/sys/signal.h only Sun sol did not find same type of information. (3 Replies)
Hi,
when I execute a script on unix AIX, I've got an error message:
"Execution: 85328 Signal d'alarme".
If I edit this file with "vi", I ve got the same error after a while (about 1 minute).
If I try with another user I still have the problem.
But if I rename this file, no problem.
My... (5 Replies)
I thought one used the select function to wait on multiple semaphores but according to http://opengroup.org/onlinepubs/007908799/xsh/select.html, the select function is only good for I/O features (like pipes and fifos).
How can I block for multiple semaphores? What if I have a mixture of things... (1 Reply)
#include <signal.h>
void handler(int sig) {
int i;
for( i=0; i<=999999; i++ ) {
}
printf("Received signal: %d\n", sig);
}
int main() {
signal(SIGINT, handler);
while (1) {
}
return 0;
}
When SIGINT is delivered for the first time, shouldn't the handler code be... (7 Replies)
Hi guys,
this is my first posting, so at first hi to everyone! ;)
I have a problem with ucontext_t in connection with signal handling. I want to simulate a preemptive scheduler. I am using the iTimer with ITIMER_PROF, to schedule the interrupts. You find the code below:
#include <stdio.h>... (18 Replies)
We have written a deamon which have many threads.
We are registering for the SIGTERM and trying to close main thread in this signal handling. Actually these are running on Mac OS X ( BSD unix). When we are unloading the deamon with command launchctl, it's sending SIGTERM signal to our process... (1 Reply)
I am trying to write a small program where I can send signals and then ask for an action to be triggered if that signal is received. For example, here is an example where I am trying to write a programme that will say you pressed ctrl*c when someone presses ctrl+c. My questions are what you would... (1 Reply)
Is it possible to send a custom signal to a process?
e.g. Send signal 9999 to my process, which handles it with some custom handler.
How would one do this? (12 Replies)
I have a problem with signal handlers not working.
I have a long 1000 line code and somehow this code for signal handling is not working:
$SIG{INT} = \&interrupt;
sub interrupt {
print STDERR "Caught a control c!\n";
exit; # or just about anything else you'd want to do
}
Any... (2 Replies)
Hi Gurus,
Some questions regarding wait. I have tried searching in this forum for threads on wait but not completely got what I am looking for.
Background:
One script (.sh) that starts/calls a reference to an application's executable and submits a batch job to it. Objective is to wait... (2 Replies)