3 //=============================================================================
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //=============================================================================
11 #ifndef ACE_SIG_ADAPTER_H
12 #define ACE_SIG_ADAPTER_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/ACE_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/Event_Handler.h"
23 #include "ace/Signal.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 * @class ACE_Sig_Adapter
30 * @brief Provide an adapter that transforms various types of signal
31 * handlers into the scheme used by the ACE_Reactor.
33 class ACE_Export ACE_Sig_Adapter
: public ACE_Event_Handler
36 ACE_Sig_Adapter (ACE_Sig_Action
&, int sigkey
);
37 ACE_Sig_Adapter (ACE_Event_Handler
*, int sigkey
);
38 ACE_Sig_Adapter (ACE_Sig_Handler_Ex
, int sigkey
= 0);
39 ~ACE_Sig_Adapter () override
= default;
41 /// Returns this signal key that's used to remove this from the
42 /// ACE_Reactor's internal table.
45 /// Called by the ACE_Reactor to dispatch the signal handler.
46 int handle_signal (int, siginfo_t
*, ucontext_t
*) override
;
48 ACE_ALLOC_HOOK_DECLARE
;
51 /// Key for this signal handler (used to remove it).
54 /// Is this an external handler or an ACE handler?
57 /// We're just wrapping an ACE_Event_Handler.
59 /// An ACE_Sig_Action.
61 /// A normal C function.
65 /// This should be a union, but C++ won't allow that because the
66 /// ACE_Sig_Action has a constructor.
67 /// This is an external handler (ugh).
70 /// This is an ACE event handler.
71 ACE_Event_Handler
*eh_
{};
73 /// This is a normal C function.
74 ACE_Sig_Handler_Ex sig_func_
;
77 ACE_END_VERSIONED_NAMESPACE_DECL
79 #include /**/ "ace/post.h"
81 #endif /* ACE_SIG_ADAPTER_H */