00001 /* 00002 Copyright 2003 by Marc J. Rochkind. All rights reserved. 00003 May be copied only for purposes and under conditions described 00004 on the Web page www.basepath.com/aup/copyright.htm. 00005 00006 The Example Files are provided "as is," without any warranty; 00007 without even the implied warranty of merchantability or fitness 00008 for a particular purpose. The author and his publisher are not 00009 responsible for any damages, direct or incidental, resulting 00010 from the use or non-use of these Example Files. 00011 00012 The Example Files may contain defects, and some contain deliberate 00013 coding mistakes that were included for educational reasons. 00014 You are responsible for determining if and how the Example Files 00015 are to be used. 00016 00017 */ 00018 #ifndef _UXSIGSET_HPP_ 00019 #define _UXSIGSET_HPP_ 00020 00021 namespace Ux { 00022 00023 /** 00024 \ingroup Ux 00025 */ 00026 class Sigset : public sigset_t, public Base { 00027 protected: 00028 00029 public: 00030 /** 00031 Initializes set to empty. 00032 */ 00033 Sigset(void) 00034 { 00035 empty(); 00036 } 00037 /** 00038 Calls ::sigaddset. 00039 */ 00040 void add(int signum) 00041 { 00042 if (::sigaddset(this, signum)) 00043 throw Error(errno); 00044 } 00045 /** 00046 Calls ::sigdelset. 00047 */ 00048 void del(int signum) 00049 { 00050 if (::sigdelset(this, signum)) 00051 throw Error(errno); 00052 } 00053 /** 00054 Calls ::sigemptyset. 00055 */ 00056 void empty(void) 00057 { 00058 if (::sigemptyset(this)) 00059 throw Error(errno); 00060 } 00061 /** 00062 Calls ::sigfillset. 00063 */ 00064 void fill(void) 00065 { 00066 if (::sigfillset(this)) 00067 throw Error(errno); 00068 } 00069 /** 00070 Calls ::sigismember. 00071 */ 00072 bool ismember(int signum) const 00073 { 00074 int r; 00075 00076 if ((r = ::sigismember(this, signum)) == -1) 00077 throw Error(errno); 00078 return r == 1; 00079 } 00080 /** 00081 Calls ::sigpending. (Probably should be in Process instead of here.) 00082 */ 00083 void pending(void) 00084 { 00085 if (::sigpending(this) == -1) 00086 throw Error(errno); 00087 } 00088 }; 00089 } // namespace 00090 00091 #endif // _UXSIGSET_HPP_