libassa  3.5.1
SigSet.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //------------------------------------------------------------------------------
3 // SigSet.h
4 //------------------------------------------------------------------------------
5 // Copyright (c) 1997 by Vladislav Grinchenko
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //------------------------------------------------------------------------------
12 #ifndef _SigSet_h
13 #define _SigSet_h
14 
15 // System includes
16 //
17 #include <signal.h>
18 #include <errno.h>
19 
20 namespace ASSA {
21 
22 #if !defined(WIN32)
23 
52 class SigSet
53 {
54 public:
58  SigSet();
59 
62  SigSet(sigset_t* source_);
63 
66  ~SigSet();
67 
74  int empty (void);
75 
82  int fill(void);
83 
90  int add(int signo_);
91 
97  int del(int signo_);
98 
104  int is_member(int signo_);
105 
109  operator sigset_t *();
110 
111 private:
113  sigset_t m_sigset;
114 };
115 
116 inline
118 SigSet() { (int) sigemptyset(&m_sigset); }
119 
120 inline
122 SigSet(sigset_t* s_) { m_sigset = *s_; }
123 
124 inline
126 ~SigSet() { /* no-op */ }
127 
128 inline int
130 empty(void) { return sigemptyset(&m_sigset); }
131 
132 inline int
134 fill(void) { return sigfillset(&m_sigset); }
135 
136 inline int
138 add(int signo_) { return sigaddset(&m_sigset,signo_); }
139 
140 inline int
142 del(int signo_) { return sigdelset(&m_sigset,signo_); }
143 
144 inline int
146 is_member(int signo_) { return sigismember(&m_sigset,signo_); }
147 
148 inline
149 SigSet::
150 operator sigset_t *() { return &m_sigset; }
151 
152 #endif // !defined(WIN32)
153 
154 } // end namespace ASSA
155 
156 #endif /* _SigSet_h */
SigSet()
Default constructor creates SigSet object with an empty signal set.
Definition: SigSet.h:118
sigset_t m_sigset
POSIX signal set.
Definition: SigSet.h:113
int fill(void)
This function initializes a signal set to be full; all the signals defined by POSIX will be in the se...
Definition: SigSet.h:134
int empty(void)
This function initializes a signal set to be empty, no signals in it.
Definition: SigSet.h:130
~SigSet()
Destructor.
Definition: SigSet.h:126
int is_member(int signo_)
Use this function to tell whether the signal signo_ is in the set.
Definition: SigSet.h:146
int del(int signo_)
This function removes the signal signo_ from the set.
Definition: SigSet.h:142
int add(int signo_)
This function adds the signal numbered signo_ to the set.
Definition: SigSet.h:138
Definition: Acceptor.h:40