Questions tagged [signal-handling]

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).

Filter by
Sorted by
Tagged with
7 votes
2 answers
2k views

Proper implementation of signal handler and multithreading (pthread)

I am trying to implement a "proper" signal handler that works correctly for multiple threads, and to be as C-standard-conforming and POSIX-conforming as possible. The below is my ...
D.J. Elkind's user avatar
4 votes
1 answer
283 views

A deamon for sending poem to clients based on KISS

My code is about sending random poem from /etc/poem.conf to client using TCP sockets. In this implementation my daemon have restart mechanism using SIGHUP signal and DEBUG mechanism using defining ...
alirezaarzehgar's user avatar
6 votes
1 answer
2k views

Client server communications through unix signals in C

For school, I have to create a server-client communication through Unix signals and only with SIGUSR1 and SIGUSR2. Client ...
dieri's user avatar
  • 61
3 votes
1 answer
102 views

System V signal API using the standard POSIX API

I wrote a program that implements a POSIX signal API. It implements the functions sigset(), sighold(), ...
Lorand's user avatar
  • 31
3 votes
1 answer
106 views

An attempt to use the sigpending function

I wrote a program that uses the sigpending () function. The program returns blocked or pending signals. My question is, what else could I improve or what problems ...
Mark's user avatar
  • 449
0 votes
1 answer
932 views

Basic Client/Server model using Unix signals

I've created a basic client/server model using user defined signals (SIGUSR1 representing bit 1 and SIGUSR2 for bit 0). At a ...
Question's user avatar
3 votes
2 answers
131 views

Posix signal implementation

My hobby is Unix-like operating systems. Recently I began writing my own sel4-based Posix compliant OS. Here's the code for internal signal handling functions which presents a kind of backend to help ...
Сергей Волкович's user avatar
5 votes
1 answer
7k views

C++ event loop and thread signaling

Use case This is an event loop and signaling system I created for a piece of software which will have multiple asynchronous server/clients/event-emitters/ui, some of those components will have their ...
fededevi's user avatar
  • 310
4 votes
1 answer
5k views

Suspend and resume a thread using signals

The other day I ran into this question on stackoverflow. Just for curiosity I wanted to implement suspending and resuming the thread, so I used signals and used ...
Shubham's user avatar
  • 143
3 votes
1 answer
7k views

Dynamically Change Logging Level of a Python Process

The intention of following code is to dynamically change the logging level of a running python process that has imported this module. ...
Abhinav Agarwal's user avatar
9 votes
2 answers
6k views

Safely and elegantly handling UNIX signals in Qt applications

When you search the web on how to gracefully shut down your Qt application when receiving SIGTERM, you are invariably directed towards this informative, yet ...
Fritz's user avatar
  • 193
4 votes
0 answers
1k views

SIGCONT Handler for terminal application

I'm writing a C++ application for POSIX environment with terminal-based User Interface. I'd like to make my application's UI be consistent between Ctrl-Z and ...
Byoungchan Lee's user avatar
3 votes
1 answer
56 views

Bash script that displays and kills selected processes

This is my first Bash script and I decided to use what I've learned so far to help manage stray processes while I develop in my *nix environs. I've tested the script extensively and it seems to work ...
user avatar
2 votes
1 answer
232 views

Git post-receive hook writen as a POSIX shell script (utilising a named pipe)

This is my first piece of code to post here. I wrote this script as a post-receive hook for a Git repository but I’m not so concerned with the Git parts (I’d like to have the part marked with ...
Anthony Geoghegan's user avatar
8 votes
1 answer
3k views

Freeing shared memory with a signal handler

I have a homework question that asks me to get 2 integers from the user, put them in shared memory, fork a child, have the child add them and put the result in shared memory, and then the child will ...
DaleSwanson's user avatar
2 votes
1 answer
2k views

Python script that launches a process that it needs to clean up after and kill on receiving SIGTERM/SIGINT

I'm using a Python script to run a particular program that occasionally may need to be terminated (by receiving a SIGINT or SIGTERM) in which case a clean up process needs to be invoked (before ...
Nobilis's user avatar
  • 121
8 votes
1 answer
3k views

Questions regarding the use of Requests Futures for accessing REST URLs

This is a much simplified version of the real code focusing just on the handling of Futures from Requests Futures. I have a few questions: I had to implement my own version of ...
Sean Perry's user avatar
  • 1,189
5 votes
1 answer
3k views

Handling SIGINT signal for a server program

I have created a small server program that encrypts text using a named pipe: ...
Searock's user avatar
  • 183