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
1
vote
1 answer
handling sigusr1 and sigusr2, works for only sigusr2
This is (almost) a homework question. I have a sender and a receiver program. Sender takes pid of receiver and int t as command line parameters. It has a string which consists of As and Bs(e.g. "AABBBA") and sends this string to receiver via…

user3717434
- 215
- 4
- 19
1
vote
1 answer
Signal Handler return and resume the program execution
I am working on legacy application development which involves lot of signal handling and virtulization. I am facing difficult in understading the below mentioned scenario...
Program flow:
(A) SIGTRAP -> (B) Process -> (C) SIGTRAPHANDLER -> (D) foo()…

Snake
- 63
- 1
- 9
1
vote
2 answers
Handling POSIX signals: how to get stack trace without using backtrace_symbols?
I'm trying to add simple crash logging to my C++ application for Mac OS and Linux. I'm not happy with backtrace_symbols output. I'd like to take whatever backtrace() returns and build stack trace (with symbolic names) manually. How to do it? I…

Violet Giraffe
- 32,368
- 48
- 194
- 335
1
vote
0 answers
Cannot receive signal in python on windows
On windows I am trying to send signal through python script and receiving it in another but in the receiving script my signal handler is not getting called.
Following are the scripts :
signal.py
import signal
import os
import sys
import…

user3206480
- 11
- 3
1
vote
1 answer
Exiting from foreign module in Python (Signal Handling)
I wrote a little script that does something extremely time-consuming in Python and I included a signal handling module that listens for SIGINT, SIGQUIT and SIGINFO, printing the status when either SIGQUIT or SIGINFO are inputted by the user and…

hellerve
- 508
- 1
- 6
- 30
1
vote
2 answers
Wrong printing when using signal handler
I have encountered problems on signal handling when writing a shell-like program on C.
Here is the simplified version of my code:
#include
#include
#include
#include
#include
#define SIZE…

Cheng KimHo
- 13
- 3
1
vote
1 answer
Information regarding Internal signal handler table in Linux?
In Linux suppose I install a signal handler for a user defined signal number (say for signal 10). Something like:
signal(fun, 10); //fun() as signal handler for user defined signal 10
I wanted to inquire what is going in the background behind this.…

whatisinaname
- 333
- 4
- 15
1
vote
3 answers
Race condition in signal handler with static variable
In a single threaded program, does a race condition is possible in a signal handler?
void signal_handler(...)
{
static int i = 0;
i = i + 10 * 10;
}
Imagine that two very close signals are thrown, so close that they enter the function at the…

Pierre T.
- 380
- 1
- 13
1
vote
1 answer
What is good way share reloadable config parameters for perl scripts
I have a lot of small Perl daemons with a common configuration.
Currently, I use this to load the settings:
In myconfig.pm:
package MyConfig;
use base 'Exporter';
BEGIN {
our @EXPORT = qw( $DB_DSN $DB_USER $DB_PWD );
}
our @EXPORT;
use vars…

Korjavin Ivan
- 439
- 1
- 5
- 15
1
vote
2 answers
Intel CPU OpenCL in Mono killed by SIGXCPU (Ubuntu)
Some time ago I wrote simple boids simulation using OpenCL (was school assignment), using C#, Cloo for OpenCL and OpenTK for OpenGL output. I tested it on Windows7 with AMD CPU implementation of OpenCL and on friend's NVidia.
Now I tried it on Linux…

jkavalik
- 1,296
- 11
- 21
1
vote
3 answers
A function that use global variable but exit, should still be avoided in signal handlers ?
As I studied something about unix programming with C, I've learned that functions that fails to be reentrant should be avoided inside a signal handler, but if I've something like:
int main(int argc, char** argv){
...
fileFd=open(...)
…

cifz
- 1,078
- 7
- 24
1
vote
2 answers
Python-QTableWidget: How to catch signal when sorting in header is clicked
While filling tableWidget with some text I've used self.ui.tableWidget.resizeRowToContents for every row.
After that and: self.ui.tableWidget.setSortingEnabled(1) ,sorting is working as expected but rows are not resize to content anymore, in fact…

Aleksandar
- 3,541
- 4
- 34
- 57
1
vote
1 answer
Autosys: KILLJOB event leaves orphan processes
I am running a variety of processes on a Windows server ( a mix of batch files, java, perl, csharp scripts/applications). These processes are launched using Autosys. The autosys agent on Windows always prefixes the command I provide in the job…

Manvendra Gupta
- 406
- 5
- 9
1
vote
1 answer
signal handling by sigaction
i was reading about the use of pselect system call when i came across this code and comments...
static void handler(int sig) { /* do nothing */ }
int main(int argc, char *argv[])
{
fd_set readfds;
struct sigaction sa;
int nfds,…

AvinashK
- 3,309
- 8
- 43
- 94
0
votes
1 answer
SIGINT received from children processes too
I have 2 programs (written by me). The first one called "MAN" will invoke "D" (the second one) which is a process that will run in background until terminated in some ways.
I would like to terminate MAN without terminating D.
I try to terminate MAN…

Francesco Belladonna
- 11,361
- 12
- 77
- 147