Also use Objects as part of an operation but as a result don't generate Any operation...
[ACE_TAO.git] / ACE / ace / OS_NS_signal.h
blob8cf09884e43ff09cbc5ab3ec2b7ba1756f62a938
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file OS_NS_signal.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Jesper S. M|ller<stophph@diku.dk>
9 * @author and a cast of thousands...
11 * Originally in OS.h.
13 //=============================================================================
15 #ifndef ACE_OS_NS_SIGNAL_H
16 # define ACE_OS_NS_SIGNAL_H
18 # include /**/ "ace/pre.h"
20 # include "ace/config-lite.h"
22 # if !defined (ACE_LACKS_PRAGMA_ONCE)
23 # pragma once
24 # endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include "ace/os_include/os_signal.h"
27 #include /**/ "ace/ACE_export.h"
29 #if defined (ACE_EXPORT_MACRO)
30 # undef ACE_EXPORT_MACRO
31 #endif
32 #define ACE_EXPORT_MACRO ACE_Export
34 #if defined (__Lynx__) || defined (__OpenBSD__)
35 // LynxOS and OpenBSD define pthread_sigmask() in pthread.h
36 # include "ace/os_include/os_pthread.h"
37 #endif /* __Lynx__ || OpenBSD */
40 * We inline and undef some functions that may be implemented
41 * as macros on some platforms. This way macro definitions will
42 * be usable later as there is no way to save the macro definition
43 * using the pre-processor.
46 #if !defined (ACE_LACKS_SIGSET)
47 inline int ace_sigemptyset_helper (sigset_t *s)
49 # if defined (sigemptyset)
50 return sigemptyset (s);
51 # undef sigemptyset
52 # else
53 return ACE_STD_NAMESPACE::sigemptyset (s);
54 # endif /* defined (sigemptyset) */
57 inline int ace_sigfillset_helper (sigset_t *s)
59 # if defined (sigfillset)
60 return sigfillset (s);
61 # undef sigfillset
62 # else
63 return ACE_STD_NAMESPACE::sigfillset (s);
64 # endif /* defined (sigfillset) */
67 inline int ace_sigaddset_helper (sigset_t *s, int signum)
69 # if defined (sigaddset)
70 return sigaddset (s, signum);
71 # undef sigaddset
72 # else
73 return ACE_STD_NAMESPACE::sigaddset (s, signum);
74 # endif /* defined (sigaddset) */
77 inline int ace_sigdelset_helper (sigset_t *s, int signum)
79 # if defined (sigdelset)
80 return sigdelset (s, signum);
81 # undef sigdelset
82 # else
83 return ACE_STD_NAMESPACE::sigdelset (s, signum);
84 # endif /* defined (sigdelset) */
87 inline int ace_sigismember_helper (sigset_t *s, int signum)
89 # if defined (sigismember)
90 return sigismember (s, signum);
91 # undef sigismember
92 # else
93 return ACE_STD_NAMESPACE::sigismember (s, signum);
94 # endif /* defined (sigismember) */
96 #endif /* !defined (ACE_LACKS_SIGSET) */
98 #if defined (ACE_HAS_SIGSUSPEND)
99 inline int ace_sigsuspend_helper (const sigset_t *s)
101 # if defined (sigsuspend)
102 return sigsuspend (s);
103 # undef sigsuspend
104 # else
105 return ACE_STD_NAMESPACE::sigsuspend (s);
106 # endif /* defined (sigsuspen) */
108 #endif /* ACE_HAS_SIGSUSPEND */
111 # if !defined (SIG_BLOCK)
112 # define SIG_BLOCK 1
113 # endif /* SIG_BLOCK */
115 # if !defined (SIG_UNBLOCK)
116 # define SIG_UNBLOCK 2
117 # endif /* SIG_UNBLOCK */
119 # if !defined (SIG_SETMASK)
120 # define SIG_SETMASK 3
121 # endif /* SIG_SETMASK */
123 // Create some useful typedefs.
125 # if !defined (ACE_HAS_SIGINFO_T)
126 struct ACE_Export siginfo_t
128 siginfo_t (ACE_HANDLE handle);
130 /// Win32 HANDLE that has become signaled.
131 ACE_HANDLE si_handle_;
133 # endif /* ACE_HAS_SIGINFO_T */
135 #if !defined (ACE_WIN32)
136 extern "C"
138 typedef void (*ACE_SIGNAL_C_FUNC)(int, siginfo_t *, void *);
140 #endif /* ACE_WIN32 */
142 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
144 // This hack is needed to get around an odd and hard-to-reproduce problem
145 // with HP aC++. If struct sigaction is defined extern "C" and the sigaction
146 // function in namespace ACE_OS, the compiler sometimes gets confused.
147 // If we help it with this typedef, it's fine. User code should not use
148 // the ACE typedef - it will be removed without warning as soon as we can
149 // either drop support for the broken compilers or figure out how to reproduce
150 // it so it can be reported to HP and fixed.
151 // There's a similar hack in OS_TLI.h for struct t_optmgmt.
152 // Also see ChangeLog entries:
153 // Mon Jan 23 16:35:40 UTC 2006 Steve Huston <shuston@riverace.com>
154 // Mon Jan 23 22:08:56 UTC 2006 Steve Huston <shuston@riverace.com>
155 #if defined (__HP_aCC) && (__HP_aCC <= 37300)
156 typedef extern "C" struct sigaction ACE_SIGACTION;
157 #else
158 typedef struct sigaction ACE_SIGACTION;
159 #endif
161 namespace ACE_OS {
163 //@{ @name A set of wrappers for Signals.
165 ACE_NAMESPACE_INLINE_FUNCTION
166 int kill (pid_t pid,
167 int signum);
169 #ifdef pthread_sigmask
170 # define ACE_PTHREAD_SIGMASK_MACRO pthread_sigmask
171 # undef pthread_sigmask
172 #endif
173 ACE_NAMESPACE_INLINE_FUNCTION
174 int pthread_sigmask (int how,
175 const sigset_t *nsp,
176 sigset_t *osp);
178 ACE_NAMESPACE_INLINE_FUNCTION
179 int sigaction (int signum,
180 const ACE_SIGACTION *nsa,
181 ACE_SIGACTION *osa);
183 ACE_NAMESPACE_INLINE_FUNCTION
184 int sigaddset (sigset_t *s,
185 int signum);
187 ACE_NAMESPACE_INLINE_FUNCTION
188 int sigdelset (sigset_t *s,
189 int signum);
191 ACE_NAMESPACE_INLINE_FUNCTION
192 int sigemptyset (sigset_t *s);
194 ACE_NAMESPACE_INLINE_FUNCTION
195 int sigfillset (sigset_t *s);
197 ACE_NAMESPACE_INLINE_FUNCTION
198 int sigismember (sigset_t *s,
199 int signum);
201 ACE_NAMESPACE_INLINE_FUNCTION
202 ACE_SignalHandler signal (int signum,
203 ACE_SignalHandler);
205 ACE_NAMESPACE_INLINE_FUNCTION
206 int sigprocmask (int how,
207 const sigset_t *nsp,
208 sigset_t *osp);
210 ACE_NAMESPACE_INLINE_FUNCTION
211 int sigsuspend (const sigset_t *s);
213 ACE_NAMESPACE_INLINE_FUNCTION
214 int raise (const int signum);
215 //@}
217 } /* namespace ACE_OS */
219 ACE_END_VERSIONED_NAMESPACE_DECL
221 # if defined (ACE_HAS_INLINED_OSCALLS)
222 # if defined (ACE_INLINE)
223 # undef ACE_INLINE
224 # endif /* ACE_INLINE */
225 # define ACE_INLINE inline
226 # include "ace/OS_NS_signal.inl"
227 # endif /* ACE_HAS_INLINED_OSCALLS */
229 # include /**/ "ace/post.h"
230 #endif /* ACE_OS_NS_SIGNAL_H */