#include <interrupt_listener.h>
◆ ~InterruptListenerHandle()
cuttlefish::InterruptListenerHandle::~InterruptListenerHandle |
( |
| ) |
|
◆ InterruptListenerHandle() [1/3]
◆ InterruptListenerHandle() [2/3]
◆ InterruptListenerHandle() [3/3]
cuttlefish::InterruptListenerHandle::InterruptListenerHandle |
( |
size_t |
listener_index | ) |
|
|
inlineprivate |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ PushInterruptListener
Allows reacting to interrupt-like signals (SIGINT, SIGHUP, SIGTERM). A global stack of interrupt listeners is maintained. When an interrupt signal is received the listener at top of the stack is executed. Returns an object that, when destroyed, disables the listener at the top of the stack, re-enabling the previous one. This function is not thread-safe and shouldn't be called from multiple threads, not even with synchronization. The listeners are executed in a background thread, not in the actual interrupt handler. It's ok to run blocking code in that thread, but disabling the listener may wait for the thread to finish executing, so if the code in the listener could wait for the thread that disables it a deadlock may occur. Similarly, disabling the listener from inside the listener will lead to a deadlock. The listener is given the actual signal received, one of SIGINT, SIGHUP or SIGTERM. To disable the listener (pop it from the listener stack) just destroy the returned handle.
◆ listener_index_
const size_t cuttlefish::InterruptListenerHandle::listener_index_ |
|
private |
The documentation for this class was generated from the following files: