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

How to kill a process and all of its children in C when executing the process by execv()?

I'm trying to implement a timeout-like command on a unix-based operating system as follows: int pid; timer_t timer_id; struct sigevent timer_event; struct itimerspec timer_value; void timeout_signal_handler(int…
moorara
  • 3,897
  • 10
  • 47
  • 60
3
votes
3 answers

Qt Unique connection

I was wondering either there is a possibility in Qt, co create a signal-slot connection, that will automatically break all other connections to this particular slot/ signal? I would appreciate all help.
Łukasz Przeniosło
  • 2,725
  • 5
  • 38
  • 74
3
votes
1 answer

"Subliminal" message in matlab

I'm trying to sum two signals at the same frequency, one recorded from the microphone and another that it’s a Matlab default sound file, what I'm intending to do is to make them sound at the same time, while I can record, and play the wav file I…
GoatZero
  • 219
  • 2
  • 14
3
votes
0 answers

Emulating sigwaitinfo on Mac OS X?

As far as I could tell, sigwaitinfo() is not available on Mac OS X. Is there any other, possibly OS X specific, function that could be used to emulate this function behavior? I.e. wait until a signal is sent and then being able to access a siginfo_t…
Thomas Moulard
  • 5,151
  • 2
  • 21
  • 28
3
votes
1 answer

Is there a way to listen to signals on Windows

I'm writing a small shell for Windows in Rust, and want to kill the Command I spawned and prevent my shell from quitting. Is there a way of capturing the Windows SIGINT equivalent in Rust?
lines
  • 141
  • 5
3
votes
2 answers

Is it possible to disable the light-blue mouse over highlighting on a QTreeWidgetItem?

I've a QTreeWidget and need to disable the mouse over highlighting on the childItems but not the click selection. The point here is, that I need to set this per Item because some are selectable. I was thinking about the QTreeWidget::itemEntered…
Nitro.de
  • 821
  • 10
  • 27
3
votes
1 answer

Signal not delivered for a very long time (about 20 seconds)

A signal that a process has sent to itself from within a signal handler could not get delivered for about 20 seconds and then it was delivered. What could be the probable causes? I would like to know the probable reasons in general. The actual Code…
Sandeep
  • 18,356
  • 16
  • 68
  • 108
3
votes
2 answers

How to get further information on SIGFPE signal?

This is from The GNU C Library Reference Manual int SIGFPE The SIGFPE signal reports a fatal arithmetic error. This signal actually covers all arithmetic errors, including division by zero and overflow. BSD systems provide the SIGFPE handler…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
3
votes
0 answers

how to do i get the status of satellites i.e. alive or dead while flight is in air

I'm just planning to build small app in Android which checks the status of satellite i.e. alive or dead. In airplane cabin, crew member can use internet from the mulitple Wireless Access Point which are connected to Satellite modem. The satellite…
sia
  • 1,872
  • 1
  • 23
  • 54
3
votes
0 answers

signal handling in python not working for multi threaded program

I have a multi threaded program with the flow as below: Main program: #Listen to the signal signal.signal(signal.SIGINT, some_function) #Actual logic by calling some other function, which spawns multiple threads try: core_logic() <--- any…
Sandy
  • 187
  • 3
  • 16
3
votes
3 answers

Boost signals and passing class method

I've defined some signal: typedef boost::signals2::signal SomeSig; typedef SomeSig::slot_type SomeSigType; I have some class: class SomeClass { SomeClass() { SomeSig.connect(&SomeClass::doMethod); } void…
Max Frai
  • 61,946
  • 78
  • 197
  • 306
3
votes
1 answer

jBPM 6.2.0 send recurring Task reminder after 1 day time interval if the task is not complete

I am new to jBPM. I am working on jBPM version 6.2.0. I want to perform following tasks. Send reminder email to user / group. Remind the user again after 1 business day if the task is not yet complete. Continue to send reminder everyday untill…
3
votes
3 answers

Handling multiple signals with one trap in bash

There is question about multiple bash traps for same signal. What about the opposite version? Is possible to write something like this: sighand () { case $1 in 1) echo "CATCH: SIGHUP" ;; 2) echo "CATCH: SIGINIT" …
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122
3
votes
2 answers

SIGSEGV signal handler is not called from the secondary thread c++ windows

In the following simple test code, the SIGSEGV signal handler is not called from the secondary thread, although in case if the crash is in main thread, it's called. The handler of SIGABRT signal is called in both cases. Could anyone explain why or…
3
votes
1 answer

sigwait in Linux (Fedora 13) vs OS X

So I'm trying to create a signal handler using pthreads which works on both OS X and Linux. The code below works on OS X but doesn't work on Fedora 13. The application is fairly simple. It spawns a pthread, registers SIGHUP and waits for a signal.…
Silas
  • 43
  • 5
1 2 3
99
100