Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Sig_Adapter.h
blob903e2ddbb9ddf13f33972bda7cfeaf2a8ebde55a
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Sig_Adapter.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
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)
19 # 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
27 /**
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
35 public:
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.
43 int sigkey () const;
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;
50 private:
51 /// Key for this signal handler (used to remove it).
52 int const sigkey_;
54 /// Is this an external handler or an ACE handler?
55 enum
57 /// We're just wrapping an ACE_Event_Handler.
58 ACE_HANDLER,
59 /// An ACE_Sig_Action.
60 SIG_ACTION,
61 /// A normal C function.
62 C_FUNCTION
63 } type_;
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).
68 ACE_Sig_Action sa_;
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 */