Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Signals.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Execution_Signals_h_
5#define _Stroika_Foundation_Execution_Signals_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <csignal>
10#include <thread>
11
13#include "Stroika/Foundation/Common/Common.h"
14
15/**
16 * Description:
17 *
18 * This module defines support for POSIX (and std c++ defined) Signals (not to be confused
19 * with the 'Signals and slots' design pattern which is largely unrelated).
20 *
21 *
22 * TODO:
23 *
24 */
25
27
28#if !qCompilerAndStdLib_Supports_errno_t
29 using errno_t = int;
30#endif
31
32 /**
33 */
34 using SignalID = int;
35
36 /**
37 */
38 Characters::String SignalToName (SignalID signal);
39
40 /**
41 * Send the given signal to a specific thread (within this process)
42 *
43 * @todo EXPLAIN HOW THIS INTERACTS WITH SignalHandledr::Tyep::eSafe!!!! - use thius with eDIRECT!
44 *
45 * This function returns an errno error number.
46 * o if the error number is ESRCH, this just menans the target thread doesn't
47 * exist anymore, whcih can easily happen (race) - like if you are sending an abort
48 * to a thread but it exits first.
49 *
50 * o other error numbres - for now - generate an assertion error. The function returns
51 * zero if no error
52 */
53 errno_t SendSignal (thread::native_handle_type target, SignalID signal);
54
55}
56
57/*
58 ********************************************************************************
59 ***************************** Implementation Details ***************************
60 ********************************************************************************
61 */
62#include "Signals.inl"
63
64#endif /*_Stroika_Foundation_Execution_Signals_h_*/
errno_t SendSignal(thread::native_handle_type target, SignalID signal)