Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
SignalBlock.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Execution_Platform_POSIX_SignalBlock_h_
5#define _Stroika_Foundation_Execution_Platform_POSIX_SignalBlock_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <csignal>
10#include <mutex>
11
12#if !qStroika_Foundation_Common_Platform_POSIX
13#error "ONLY INCLUDE FOR POSIX"
14#endif
15
16#include "Stroika/Foundation/Execution/Signals.h"
17
18/**
19 *
20 * TODO:
21 */
22
24
25 /**
26 * For the lifetime of this object - save the initial signal block state for thread signals,
27 * and then block the given signal (or all for no arg CTOR). Restore on destructor.
28 *
29 * This is similar to sigblock/sigprocmask to resture (in DTOR), but only applying to the current thread,
30 * and it takes a signal as argument, not a set/mask.
31 */
33 public:
35 ScopedBlockCurrentThreadSignal (SignalID signal);
38
39 public:
40 nonvirtual ScopedBlockCurrentThreadSignal& operator= (const ScopedBlockCurrentThreadSignal&) = delete;
41
42 private:
43 sigset_t fRestoreMask_;
44 };
45
46}
47
48/*
49 ********************************************************************************
50 ***************************** Implementation Details ***************************
51 ********************************************************************************
52 */
53#include "SignalBlock.inl"
54
55#endif /*_Stroika_Foundation_Execution_Platform_POSIX_SignalBlock_h_*/