Questions tagged [signals]

A signal is a notification to a process that an event occurred. Signals are sometimes described as software interrupts. Signals are analogous to hardware interrupts in that they interrupt the normal flow of execution of a program; in most cases, it is not possible to predict exactly when a signal will arrive. They are defined in the C standards and extended in POSIX, but many other programming languages/systems provide access to them as well.

Standards

These standards actually place requirements on the signal-handling facilities:

C++11 essentially says that you get the same facilities as in C, as long as you restrict signal handlers to the common subset of C and C++, and use C linkage for them. Quoting n3242 section 18.10 "Other runtime support" [support.runtime] (paragraph 8),

The common subset of the C and C++ languages consists of all declarations, definitions, and expressions that may appear in a well formed C++ program and also in a conforming C program. A POF (“plain old function”) is a function that uses only features from this common subset, and that does not directly or indirectly use any function that is not a POF, except that it may use functions defined in Clause 29 that are not member functions. All signal handlers shall have C linkage. A POF that could be used as a signal handler in a conforming C program does not produce undefined behavior when used as a signal handler in a C++ program. The behavior of any other function used as a signal handler in a C++ program is implementation-defined.

7326 questions
3
votes
1 answer

Difference between signal and Call in sequence Diagram

In Enterprise Architect I want to model a Qt signal in a sequence diagram. I use an asynchronous call of type signal. When adding the message I can see that the asynchronous signal can be Call or Signal. I'd like to know what's the difference…
Jepessen
  • 11,744
  • 14
  • 82
  • 149
3
votes
9 answers

log rotation for nginx on windows

I've found plenty of references on the web for rotating the nginx logs under linux.. just send the USR1 signal to the process. But... unix like signals don't exist on windows and I haven't been able to find any information on this. How can I…
Arthur Blake
  • 105
  • 1
  • 1
  • 6
3
votes
1 answer

ptrace'ing multithread application

I have a "debugger"-like application, named hyper-ptrace. It starts user_appl3 which is multithreaded with NPTL. Main loop of hyper-ptrace is: wait3(&status, FLAGS, &u); // find a pid of child, which has a signal switch (signal =…
osgx
  • 90,338
  • 53
  • 357
  • 513
3
votes
1 answer

Gtk-WARNING Could not find signal handler on netbeans

I'm building an interface using glade and gtk programming on c using netbeans. I've set up my project following this tutorial. I even added libgmodule2-0.so and libglib2-0.so to the linker options of netbeans. When I run i get the warning…
gvalero87
  • 855
  • 3
  • 15
  • 32
3
votes
2 answers

Piping output from 'timeout' to 'wc -l' fails

I am trying to count all keystrokes for a given period. Currently my code looks like this: $ timeout -s 9 10s xinput test 8 | wc -l This returns Killed instead of the expected number of key presses. When i run timeout without the pipe the output…
meschi
  • 111
  • 6
3
votes
2 answers

my server doesn't handle all signals when I send it a lot of kill() commands

I have a problem with this little piece of code. I have a "server" and a "client". The server waits SIGUSR1 from the client. But when I send SIGUSR1 in a loop, the server doesn't handle every signal ! I do i++ each time I receive a signal, and I get…
raph77777
  • 111
  • 1
  • 8
3
votes
2 answers

asynchronous Inter thread communication

I'm making a cross plateform program that embbed a small RARP server (implemented with winpcap/pcap) and runs 2 TCP IP servers. I have to use C++. So i will have at least 4 threads, the main one wich countain the controller, 2 TCP/IP async socket,…
MiniScalope
  • 1,429
  • 1
  • 16
  • 22
3
votes
1 answer

Infinity Loop and user input as the termination

I have my code and it does go run to infinity. What I want is that if on the unix command window if the user inputs a ctrl C, I want the program to finish the current loop it in and then come out of the loop. So I want it to break, but I want it to…
Yuki
  • 31
  • 1
  • 5
3
votes
2 answers

Signal handler async safe functions

Is there a way I can call non async safe functions from within a signal handler? Or is this impossible? I am not looking for setting a flag from within the signal handler and then print something in my "main code" but in this case the signal…
Curious
  • 20,870
  • 8
  • 61
  • 146
3
votes
2 answers

python subprocess.call doesn't handle signal correctly

(I'm using Python 3.4.2) I have a script test.py, which handles SIGTERM etc. However, when it's called by some other script, the sig-handling wasn't correct. This is test.py: #! /path/to/python3 import time import signal import sys def…
Erika L
  • 307
  • 4
  • 9
3
votes
1 answer

Send signal to other process

since os/signal is only for handling of incoming signals I'm asking if there is a native way to send signals to other processes? Edit: The process I want to mange is nginx. My Go application should listen for some events and then send a SIGHUP to…
soupdiver
  • 3,504
  • 9
  • 40
  • 68
3
votes
1 answer

How to register a signal handler for a subprocess?

Adding a signal handler, e.g. #!/usr/bin/python import subprocess as sp import signal import time def child_handler(sig, frame): print("SIGINT child received") def handler(sig, frame): print("SIGINT received") def preexec(): …
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
3
votes
2 answers

How to catch C++ signal in QML signal handler after type registration?

I am developing a basic qml-cpp application to understand how one interacts with another. I have a MessageSetter C++ class and one main.qml. Since I wish to understand two-way communication, I exposed MessageSetter properties to qml using…
Jatin
  • 276
  • 6
  • 12
3
votes
1 answer

Find signal handler function using GDB?

I am working on a C project that has bunch of files. Now I want to find the signal handler functions, but no success while surfing the project tree. The first way I think about approaching this problem is running the binary with GDB. Is there a way…
bagrat
  • 7,158
  • 6
  • 29
  • 47
3
votes
1 answer

Updating SKMaps from 2.5.0 to 2.5.1

I have a problem due to updating SKMaps from version 2.5.0 to version 2.5.1. Something doesn’t seem to be right with the native .so library. I always have this error: 11-24 10:34:04.922 7463-7884/de.mypackage A/libc: Fatal signal 7 (SIGBUS) at…
unlimited101
  • 3,653
  • 4
  • 22
  • 41