Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
Stroika::Foundation::Execution::SignalHandler Class Reference

#include <SignalHandlers.h>

Public Types

enum class  Type
 

Public Member Functions

 SignalHandler ()=delete
 
nonvirtual void operator() (SignalID i) const
 
nonvirtual strong_ordering operator<=> (const SignalHandler &rhs) const
 Each SignalHandler constructed is its own, kept by its copies: another made the same way - even from the same function - is not equal to it. So to remove one, keep the one added.
 
nonvirtual bool operator== (const SignalHandler &rhs) const
 True only for the same SignalHandler, or a copy of it -.
 

Detailed Description

A key feature of SignalHandler versus function<void(SignalID)> is that you can compare them

Note that to do so, you must save the original SignalHandler you create to later remove it by value: creating another SignalHandler (even with the same arguments) does not compare equal (

See also
operator<=>).

Also, signal handlers come with a flag indicating that they are intended to be run in a 'safe' manner or a direct signal handling manner.

Note
BEWARE - these may be copied during invocation, which for 'direct' signal handers is a dangerous, finicky place. Copy must not do operations (like allocate memory) which would be unsafe during signal (direct) handling.

Definition at line 72 of file SignalHandlers.h.

Member Enumeration Documentation

◆ Type

A direct (eDirect) signal handler is invoked in the stack context in which the signal is delivered. Direct signal handlers are VERY UNSAFE and use carefully, since they can EASILY produce deadlocks.

A 'safe' (eSafe) signal handler is run in a separate thread context.

See also
SignalHandlerRegistry::SafeSignalsManager.
Note
Common::DefaultNames<> supported

Definition at line 85 of file SignalHandlers.h.

Constructor & Destructor Documentation

◆ SignalHandler()

Stroika::Foundation::Execution::SignalHandler::SignalHandler ( )
delete

Any overload can be used for safe exception handlers, but only the noexcept overload may be used for 'direct' exception calls (as a documentation hint - no real need).

Note
https://stackoverflow.com/questions/38760784/how-will-c17-exception-specifier-type-system-work and the existing compiler vs2k17 15.9.3 - dont support this noexcept on function objects, so try again later.

Member Function Documentation

◆ operator()()

void Stroika::Foundation::Execution::SignalHandler::operator() ( SignalID  i) const

Invoke the actual signal handler.

Definition at line 36 of file SignalHandlers.inl.

◆ operator==()

bool Stroika::Foundation::Execution::SignalHandler::operator== ( const SignalHandler &  rhs) const

True only for the same SignalHandler, or a copy of it -.

See also
operator<=>

Definition at line 47 of file SignalHandlers.inl.


The documentation for this class was generated from the following files: