aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/sigset.h
blob: f4035425e3b924a44d53df105ea2e2fad67a25e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once

// Functions for manipulating signal sets

#include "compat.h" 

#if defined _unix_
    #include <pthread.h>
#elif defined _win_
    // Flags for sigprocmask:
    #define SIG_BLOCK 1
    #define SIG_UNBLOCK 2
    #define SIG_SETMASK 3

using sigset_t = ui32;

#else
    #error not supported yet
#endif

inline int SigEmptySet(sigset_t* set) {
#if defined _unix_
    return sigemptyset(set); 
#else
    Y_UNUSED(set);
    return 0; 
#endif
}

inline int SigFillSet(sigset_t* set) {
#if defined _unix_
    return sigfillset(set); 
#else
    Y_UNUSED(set);
    return 0; 
#endif
}

inline int SigAddSet(sigset_t* set, int signo) {
#if defined _unix_
    return sigaddset(set, signo); 
#else
    Y_UNUSED(set);
    Y_UNUSED(signo);
    return 0; 
#endif
}

inline int SigDelSet(sigset_t* set, int signo) {
#if defined _unix_
    return sigdelset(set, signo); 
#else
    Y_UNUSED(set);
    Y_UNUSED(signo);
    return 0; 
#endif
}

inline int SigIsMember(const sigset_t* set, int signo) {
#if defined _unix_
    return sigismember(const_cast<sigset_t*>(set), signo);
#else
    Y_UNUSED(set);
    Y_UNUSED(signo);
    return 0; 
#endif
}

inline int SigProcMask(int how, const sigset_t* set, sigset_t* oset) {
#if defined _unix_
    return pthread_sigmask(how, set, oset);
#else
    Y_UNUSED(set);
    Y_UNUSED(oset);
    Y_UNUSED(how);
    return 0;
#endif
}