In the C Standard Library, signal processing defines how a program handles various signals while it executes. A signal can report some exceptional behavior within the program (such as division by zero), or a signal can report some asynchronous event outside the program (such as someone striking an interactive attention key on a keyboard).
Questions tagged [signal-handling]
290 questions
2
votes
0 answers
Handle Signals in Android
Does Android support signal handling i.e Signal.handle( ... ) type? Can you suggest some link which explains how to do so?

Shikhar Shrivastav
- 725
- 2
- 11
- 21
2
votes
0 answers
How to add SignalHandler to abstract Java class
I have an abstract Java class which runs as a Thread. It does not have a main method. Only run(), start(), stop(), etc.
I want to add a SignalHandler to the class. I've tried this:
Add this to the initialize method:
addSignalHandler();
That…

lulu88
- 1,694
- 5
- 27
- 41
2
votes
1 answer
Jruby Rake Task - Thread.current changes when trapping INT signal
In a rake task running on jruby-1.7.6, I spawn many Threads on demand and store each of the spawned threads:
puts Thread.current # => #
Thread.current[:spawned_threads] = {}
# New thread spawned for every new request and stored…

user2392997
- 21
- 1
2
votes
2 answers
Managing Signal Handling for daemons that fork()
I want to write a robust daemon in perl that will run on Linux and am following the template described in this excellent answer. However there are a few differences in my situation: First I am using Parallel::ForkManager start() and next; to fork on…

Gurunandan Bhat
- 3,544
- 3
- 31
- 43
2
votes
0 answers
Delete record from signal handler in Ruby on Rails with Ruby 2.0 fails with error
I have a set of Ruby daemons that, on startup, write information in a table of running daemons. The daemons run forever or until they receive a signal. A signal handler deletes the daemon's record in the database. Prior to Ruby 2.0 that worked…

RussK
- 199
- 1
- 17
2
votes
2 answers
How to execute a handler function before quit the program when receiving kill signal from"killall" or "kill -p pid"?
I have the following code:
#include
#include
#include
pthread_t test_thread;
void *thread_test_run (void *v)
{
int i=1;
while(1)
{
printf("into thread %d\r\n",i);
i++;
sleep(1);
…

MOHAMED
- 41,599
- 58
- 163
- 268
2
votes
1 answer
python subprocess avoid signal handling by the child
well, I have a usr1 signal handler in a script. By sending a SIGUSR1 from outside to my script, my handler does its work, but the signal is spread also to the child that I create via Popen. How can I do this?

ScotchAndSoda
- 3,811
- 4
- 34
- 38
2
votes
1 answer
Is it possible to obtain the Android activity stack from native code?
I am implementing a native signal handler that produces logs with richer detail than the standard tombstone files. I would like to include a dump of the current task's activity stack, to help me diagnose the bug.
One approach would be to use JNI to…

MM.
- 4,224
- 5
- 37
- 74
2
votes
1 answer
Async serial communication in non-canonical (raw) mode and generating SIGIO in linux/osx
To start off, I'm having trouble getting my serial device to generate a SIGIO when data is ready to be read.
I am trying to write a simple serial interface to communicate to a micro using a usb to serial adapter. I'd like to keep this interface as…

gabe_torres
- 105
- 1
- 8
1
vote
1 answer
what is impact if i call syscall(SYS_gettid) from signal Handler?
Can some one tell me what could be the adverse effect of calling syscall(SYS_gettid) from Signal Handler?
I know it is not in the safe functions list to be called from signal handler but I want to know reason behind it?

sandeep
- 513
- 9
- 17
1
vote
4 answers
Algorithm for base-10 numeric display - minimum changes per refresh
Quick Summary:
I'm looking for an algorithm to display a four-digit speed signal in such a way that the minimum number of (decimal) digits are changed each time the display is updated.
For example:
Filtered
Signal Display
--------------------
…

e.James
- 116,942
- 41
- 177
- 214
1
vote
1 answer
Signal handler is not getting called in main function
I am trying to study how signal handlers work. I have written code where i cause an alarm signal to raise once in every 100us. But, the signal is not raised. Here is the code :
#include
#include
#include
…

CuriousCoder
- 1,582
- 5
- 28
- 55
1
vote
1 answer
How can waitpid() reap more than one child?
In this example from the CSAPP book chap.8:
\#include "csapp.h"
/* WARNING: This code is buggy! \*/
void handler1(int sig)
{
int olderrno = errno;
if ((waitpid(-1, NULL, 0)) < 0)
sio_error("waitpid error");
Sio_puts("Handler…

sociala
- 11
- 3
1
vote
2 answers
How do you intercept a keyboard interrupt (CTRL-C) in Jython?
This is what I've tried...
from sun.misc import Signal
from sun.misc import SignalHandler
class InterruptHandler(SignalHandler):
def handle(self):
print "Shutting down server..."
Signal.handle(Signal("INT"),InterruptHandler())
It's…

espeed
- 4,754
- 2
- 39
- 51
1
vote
1 answer
How is "abort" implemented on platforms that does not support signals in C?
The abort function in C is supposed to raise a SIGABRT signal. But what if the underlying platform does not support the SIGABRT signal or does not support signals at all, for example, when C is ported to some non-Posix-compliant OSes. In this case,…

John Z. Li
- 1,893
- 2
- 12
- 19