A handler to receive notification about POSIX signals.
Synopsis
Declared in <folly/io/async/AsyncSignalHandler.h>
class AsyncSignalHandler;
Description
AsyncSignalHandler allows code to process signals from within a EventBase loop.
Standard signal handlers interrupt execution of the main thread, and are run while the main thread is paused. As a result, great care must be taken to avoid race conditions if the signal handler has to access or modify any data used by the main thread.
AsyncSignalHandler solves this problem by running the AsyncSignalHandler callback in normal thread of execution, as a EventBase callback.
AsyncSignalHandler may only be used in a single thread. It will only process signals received by the thread where the AsyncSignalHandler is registered. It is the user's responsibility to ensure that signals are delivered to the desired thread in multi‐threaded programs.
Member Functions
Name |
Description |
|
Create a new AsyncSignalHandler. |
|
Destroy the AsyncSignalHandler, unregistering any remaining signals. |
Attach this AsyncSignalHandler to an EventBase. |
|
Detach this AsyncSignalHandler from its EventBase. |
|
Get the EventBase used by this AsyncSignalHandler. |
|
Register to receive callbacks about the specified signal. |
|
|
signalReceived() will called to indicate that the specified signal has been received. |
Unregister for callbacks about the specified signal. |
Derived Classes
Name |
Description |
Derived template class that allows forwarding of a callback to be invoked in the overridden signalReceived(). |
Created with MrDocs