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
1 answer
What is si_int in siginfo and how does it affect signal propagation
As part of sending interrupts to user space I am seeing the following code snippet around but I don't understand how si_int affects the signal propagation.
static int SendToUsrSpace(void) {
struct siginfo info;
struct task_struct *t;
int…

bardao
- 914
- 12
- 23
2
votes
1 answer
is it possible to set a promise in a signal handler?
I was looking for a way to stop a thread that perform a task every 2 seconds. I decided to try to use a std::promise/future so that the thread can exit immediately when the promise is set.
#include
#include
#include…

OznOg
- 4,440
- 2
- 26
- 35
2
votes
1 answer
Python break from socket receive on SIGINT
I'm working on a program that receives data from a socket, and when a signal is sent, I want to be able to break from the receive.
What I have now:
class Killer:
die = False
def __init__(self):
signal.signal(signal.SIGINT,…

Brydon Gibson
- 1,179
- 3
- 11
- 22
2
votes
1 answer
Using Signal Handlers to Pause/Resume a Child Process
I'm currently trying to experiment with signals in C by using them to control a child process created with the fork() method. Essentially, I have a child process running the "yes" command from the linux terminal (this command just prints "y" and a…

Erick
- 23
- 1
- 3
2
votes
1 answer
QML Chart interactive
I have a pie chart created dynamically, that uses function createPieChart() described below. When a slice is clicked, I want to call a function to print out the label and value of that slice.
I am facing 2 problems:
Although I connect "clicked" or…

laurapons
- 971
- 13
- 32
2
votes
5 answers
How can a process kill itself?
#include
#include
#include
int main(){
pid_t pid = fork();
if(pid==0){
system("watch ls");
}
else{
sleep(5);
killpg(getpid(),SIGTERM); //to kill the complete…

Durin
- 2,070
- 5
- 23
- 37
2
votes
2 answers
Signal Handling Behavior in Cygwin
I have an executable loop.exe on my Windows machine that was compiled using MinGW's gcc.
The code for loop.c is behaviorally similar to:
#include
#include
#include
static int sigintReceived = 0;
void…

Den Dinh
- 197
- 1
- 10
2
votes
0 answers
C | GNU Readline and Signal Handling/Signal Safe Functions
I'm working on a problem similar to Readline: Get a new prompt on SIGINT,
but the answers given for that question don't completely satisfy the problem given.
I'm using the regular (non-callback) version of GNU readline and am writing a signal…

prions
- 33
- 4
2
votes
1 answer
How to track a process on Unix C++?
I have a program(A) that starts another program(B).
What I want is when every time B receives signal A sends this signal to B and all child processes of B. I don't really know how to implement a few things here:
1). How do I determine that signal…

user23316192
- 69
- 1
- 7
2
votes
3 answers
Writing Signal handlers for Shared libraries or DLL?
I have a Application A(by some company X). This application allows me to extend the functionality by allowing me to write my own functions.
I tell the Application A to call my user functions in the Applications A's configuration file (this is how it…

linkedlist
- 313
- 4
- 8
2
votes
1 answer
Linux C and C++: what else should I be logging when handling signals like SIGSEGV?
Working on some linux (Ubuntu) systems, running some in-house C and C++ apps (gcc).
There is a long list of signals which are handled, such as SIGSEGV and SIGINT. On signal, the callstack is obtained using backtrace(3) and backgrace_symbols(3). …

Stéphane
- 19,459
- 24
- 95
- 136
2
votes
1 answer
Signal Handling inside class
I'm having problems with signal function,
i need that the second parameter call a function of my class
signal (SIGINT, myClass_function);
but as far as i know, it needs to be static void. And so i can not access the same instance of my object to…

Melissia_M
- 323
- 2
- 13
2
votes
1 answer
OCaml's set_signal's equivalent in F#
I searched for this a bit and could not find anything. I am "translating" an OCaml chess program to F#, both as a tool to understand how a Chess representation would work and to internalize, so to speak, F#'s way of doing things that is not…

asibahi
- 857
- 8
- 14
2
votes
0 answers
Linux Kernel - Get a free signal number
I want to implement a signal link from kernel to user mode. At the moment I use a free chosen signal number. But I think it could be possible that another module uses the same.
So I'm looking for a kernel macro / function / work around to find…

Alex44
- 3,597
- 7
- 39
- 56
2
votes
1 answer
Gtkmm 'no matching function for call' errors
I am a beginner and learning Gtkmm by following their official documentation.
But this example:
https://developer.gnome.org/gtkmm-tutorial/stable/sec-menus-examples.html.en#menu-example-main
is not working and I am getting these kind of…

Gurjot Bhatti
- 977
- 1
- 10
- 24