summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2021-10-25 18:37:00 +0200
committerGitHub <noreply@github.com>2021-10-25 18:37:00 +0200
commit80d17ac691bf7224371e3d992f5f71f9fcdcadc1 (patch)
treec90137e10622e959594fc9b32282368453c35377
parent36a9f816d472c0ba515a6a9ed3f78225994c122c (diff)
parentbc69025e935e4d038bbc814c30eb8c1c47013e8b (diff)
downloadATCD-80d17ac691bf7224371e3d992f5f71f9fcdcadc1.tar.gz
Merge pull request #1704 from jwillemsen/jwi-signal
Make use of using instead of typedef, doxygen changes, use bool insteā€¦
-rw-r--r--ACE/ace/Sig_Adapter.h6
-rw-r--r--ACE/ace/Sig_Handler.h56
-rw-r--r--ACE/ace/Signal.cpp3
-rw-r--r--ACE/ace/Signal.h16
-rw-r--r--ACE/ace/Signal.inl12
-rw-r--r--ACE/ace/os_include/os_signal.h24
6 files changed, 57 insertions, 60 deletions
diff --git a/ACE/ace/Sig_Adapter.h b/ACE/ace/Sig_Adapter.h
index 0142f2e6795..903e2ddbb9d 100644
--- a/ACE/ace/Sig_Adapter.h
+++ b/ACE/ace/Sig_Adapter.h
@@ -62,12 +62,12 @@ private:
C_FUNCTION
} type_;
- // = This should be a union, but C++ won't allow that because the
- // <ACE_Sig_Action> has a constructor.
+ /// This should be a union, but C++ won't allow that because the
+ /// ACE_Sig_Action has a constructor.
/// This is an external handler (ugh).
ACE_Sig_Action sa_;
- /// This is an ACE hander.
+ /// This is an ACE event handler.
ACE_Event_Handler *eh_ {};
/// This is a normal C function.
diff --git a/ACE/ace/Sig_Handler.h b/ACE/ace/Sig_Handler.h
index 337f6a63521..d7df4bba2e7 100644
--- a/ACE/ace/Sig_Handler.h
+++ b/ACE/ace/Sig_Handler.h
@@ -77,7 +77,7 @@ public:
/// True if there is a pending signal.
static int sig_pending ();
- /// Reset the value of <sig_pending_> so that no signal is pending.
+ /// Reset the value of sig_pending_ so that no signal is pending.
static void sig_pending (int);
// = Set/get the handler associated with a particular signal.
@@ -91,7 +91,7 @@ public:
/**
* Callback routine registered with sigaction(2) that dispatches the
- * <handle_signal> method of the appropriate pre-registered
+ * handle_signal() method of the appropriate pre-registered
* ACE_Event_Handler.
*/
static void dispatch (int, siginfo_t *, ucontext_t *);
@@ -108,13 +108,12 @@ protected:
/**
* Set a new ACE_Event_Handler that is associated with @a signum.
* Return the existing handler. Does not acquire any locks so that
- * it can be called from a signal handler, such as <dispatch>.
+ * it can be called from a signal handler, such as dispatch().
*/
- static ACE_Event_Handler *handler_i (int signum,
- ACE_Event_Handler *);
+ static ACE_Event_Handler *handler_i (int signum, ACE_Event_Handler *);
/**
- * This implementation method is called by <register_handler> and
+ * This implementation method is called by register_handler() and
* @c dispatch. It doesn't do any locking so that it can be called
* within a signal handler, such as @c dispatch. It adds a new
* ACE_Event_Handler and a new sigaction associated with @a signum.
@@ -124,13 +123,13 @@ protected:
*/
static int register_handler_i (int signum,
ACE_Event_Handler *new_sh,
- ACE_Sig_Action *new_disp = 0,
- ACE_Event_Handler **old_sh = 0,
- ACE_Sig_Action *old_disp = 0);
+ ACE_Sig_Action *new_disp = nullptr,
+ ACE_Event_Handler **old_sh = nullptr,
+ ACE_Sig_Action *old_disp = nullptr);
static int remove_handler_i (int signum,
- ACE_Sig_Action *new_disp = 0,
- ACE_Sig_Action *old_disp = 0,
+ ACE_Sig_Action *new_disp = nullptr,
+ ACE_Sig_Action *old_disp = nullptr,
int sigkey = -1);
/// Check whether the SIGNUM is within the legal range of signals.
@@ -155,7 +154,7 @@ private:
* Using this class a program can register one or more
* ACE_Event_Handler with the ACE_Sig_Handler in order to
* handle a designated @a signum. When a signal occurs that
- * corresponds to this @a signum, the <handle_signal> methods of
+ * corresponds to this @a signum, the handle_signal() methods of
* all the registered ACE_Event_Handlers are invoked
* automatically.
*/
@@ -170,13 +169,13 @@ public:
* Add a new ACE_Event_Handler and a new sigaction associated with
* @a signum. Passes back the existing ACE_Event_Handler and its
* sigaction if pointers are non-zero. Returns -1 on failure and
- * a <sigkey> that is >= 0 on success.
+ * a sigkey that is >= 0 on success.
*/
- virtual int register_handler (int signum,
- ACE_Event_Handler *new_sh,
- ACE_Sig_Action *new_disp = 0,
- ACE_Event_Handler **old_sh = 0,
- ACE_Sig_Action *old_disp = 0);
+ int register_handler (int signum,
+ ACE_Event_Handler *new_sh,
+ ACE_Sig_Action *new_disp = 0,
+ ACE_Event_Handler **old_sh = 0,
+ ACE_Sig_Action *old_disp = 0) override;
/**
* Remove an ACE_Event_Handler currently associated with @a signum.
@@ -187,24 +186,23 @@ public:
* by the caller). Returns 0 on success and -1 if @a signum is
* invalid.
*/
- virtual int remove_handler (int signum,
- ACE_Sig_Action *new_disp = 0,
- ACE_Sig_Action *old_disp = 0,
- int sigkey = -1);
+ int remove_handler (int signum,
+ ACE_Sig_Action *new_disp = 0,
+ ACE_Sig_Action *old_disp = 0,
+ int sigkey = -1) override;
// = Set/get the handler associated with a particular signal.
/// Return the head of the list of ACE_Sig_Handlers associated with
- /// SIGNUM.
- virtual ACE_Event_Handler *handler (int signum);
+ /// @a signum.
+ ACE_Event_Handler *handler (int signum) override;
/**
- * Set a new ACE_Event_Handler that is associated with SIGNUM at
- * the head of the list of signals. Return the existing handler
+ * Set a new ACE_Event_Handler that is associated with @a signum at
+ * the head of the list of signals. Return the existing handler
* that was at the head.
*/
- virtual ACE_Event_Handler *handler (int signum,
- ACE_Event_Handler *);
+ ACE_Event_Handler *handler (int signum, ACE_Event_Handler *) override;
/**
* Callback routine registered with sigaction(2) that dispatches the
@@ -223,7 +221,7 @@ private:
/**
* Keeps track of the id that uniquely identifies each registered
* signal handler. This id can be used to cancel a timer via the
- * <remove_handler> method.
+ * remove_handler() method.
*/
static int sigkey_;
diff --git a/ACE/ace/Signal.cpp b/ACE/ace/Signal.cpp
index 90f09bbd13c..dcca442ef5f 100644
--- a/ACE/ace/Signal.cpp
+++ b/ACE/ace/Signal.cpp
@@ -33,8 +33,7 @@ ACE_Sig_Action::~ACE_Sig_Action ()
ACE_TRACE ("ACE_Sig_Action::~ACE_Sig_Action");
}
-// Restore the signal mask.
-
+/// Restore the signal mask.
ACE_Sig_Guard::~ACE_Sig_Guard ()
{
//ACE_TRACE ("ACE_Sig_Guard::~ACE_Sig_Guard");
diff --git a/ACE/ace/Signal.h b/ACE/ace/Signal.h
index d16268539fa..7683e9c789d 100644
--- a/ACE/ace/Signal.h
+++ b/ACE/ace/Signal.h
@@ -27,7 +27,7 @@
#include "ace/OS_NS_signal.h"
/// Type of the extended signal handler.
-typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext);
+using ACE_Sig_Handler_Ex = void (*) (int, siginfo_t *siginfo, ucontext_t *ucontext);
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -43,17 +43,17 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Sig_Set
{
public:
- /// Initialize <sigset_> with @a sigset. If @a sigset == 0 then fill
+ /// Initialize sigset_ with @a sigset. If @a sigset == 0 then fill
/// the set.
ACE_Sig_Set (sigset_t *sigset);
- /// Initialize <sigset_> with @a sigset. If @a sigset == 0 then fill
+ /// Initialize sigset_ with @a sigset. If @a sigset == 0 then fill
/// the set.
ACE_Sig_Set (ACE_Sig_Set *sigset);
- /// If @a fill == 0 then initialize the <sigset_> to be empty, else
+ /// If @a fill == false then initialize the sigset_ to be empty, else
/// full.
- ACE_Sig_Set (int fill = 0);
+ ACE_Sig_Set (bool fill = false);
~ACE_Sig_Set ();
@@ -103,7 +103,7 @@ public:
/// Assigns the various fields of a @c sigaction struct but doesn't
/// register for signal handling via the @c sigaction function.
ACE_Sig_Action (ACE_SignalHandler handler,
- sigset_t *sigmask = 0,
+ sigset_t *sigmask = nullptr,
int flags = 0);
/// Assigns the various fields of a @c sigaction struct but doesn't
@@ -119,7 +119,7 @@ public:
*/
ACE_Sig_Action (ACE_SignalHandler handler,
int signum,
- sigset_t *sigmask = 0,
+ sigset_t *sigmask = nullptr,
int flags = 0);
/**
@@ -149,7 +149,7 @@ public:
*/
ACE_Sig_Action (const ACE_Sig_Set &signalss,
ACE_SignalHandler handler,
- sigset_t *sigmask = 0,
+ sigset_t *sigmask = nullptr,
int flags = 0);
ACE_Sig_Action (const ACE_Sig_Action&) = default;
diff --git a/ACE/ace/Signal.inl b/ACE/ace/Signal.inl
index 55882f85b9f..2c130cf6d7d 100644
--- a/ACE/ace/Signal.inl
+++ b/ACE/ace/Signal.inl
@@ -13,7 +13,7 @@ ACE_Sig_Set::ACE_Sig_Set (sigset_t *ss)
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
- if (ss == 0)
+ if (ss == nullptr)
ACE_OS::sigfillset (&this->sigset_);
else
// Structure assignment.
@@ -21,7 +21,7 @@ ACE_Sig_Set::ACE_Sig_Set (sigset_t *ss)
}
ACE_INLINE
-ACE_Sig_Set::ACE_Sig_Set (int fill)
+ACE_Sig_Set::ACE_Sig_Set (bool fill)
// : sigset_ ()
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
@@ -38,7 +38,7 @@ ACE_Sig_Set::ACE_Sig_Set (ACE_Sig_Set *ss)
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
- if (ss == 0)
+ if (ss == nullptr)
ACE_OS::sigfillset (&this->sigset_);
else
this->sigset_ = ss->sigset_;
@@ -168,7 +168,7 @@ ACE_INLINE int
ACE_Sig_Action::register_action (int signum, ACE_Sig_Action *oaction)
{
ACE_TRACE ("ACE_Sig_Action::register_action");
- struct sigaction *sa = oaction == 0 ? 0 : oaction->get ();
+ struct sigaction *sa = oaction == nullptr ? nullptr : oaction->get ();
return ACE_OS::sigaction (signum, &this->sa_, sa);
}
@@ -203,8 +203,8 @@ ACE_Sig_Guard::ACE_Sig_Guard (ACE_Sig_Set *mask,
#if defined (ACE_LACKS_UNIX_SIGNALS)
ACE_UNUSED_ARG (mask);
#else
- // If MASK is 0 then block all signals!
- if (mask == 0)
+ // If MASK is nullptr then block all signals!
+ if (mask == nullptr)
{
# if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
ACE_OS::sigprocmask (SIG_BLOCK,
diff --git a/ACE/ace/os_include/os_signal.h b/ACE/ace/os_include/os_signal.h
index 32161dfaf70..e98ef206875 100644
--- a/ACE/ace/os_include/os_signal.h
+++ b/ACE/ace/os_include/os_signal.h
@@ -151,28 +151,28 @@ extern "C"
#if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES)
// Prototypes for both signal() and struct sigaction are consistent..
- typedef void (*ACE_SignalHandler)(int);
- typedef void (*ACE_SignalHandlerV)(int);
+ using ACE_SignalHandler = void (*)(int);
+ using ACE_SignalHandlerV = void (*)(int);
#elif defined (ACE_HAS_SVR4_SIGNAL_T)
// SVR4 Signals are inconsistent (e.g., see struct sigaction)..
- typedef void (*ACE_SignalHandler)(int);
- typedef void (*ACE_SignalHandlerV)(void);
+ using ACE_SignalHandler = void (*)(int);
+ using ACE_SignalHandlerV = void (*)(void);
#elif defined (ACE_WIN32)
- typedef void (__cdecl *ACE_SignalHandler)(int);
- typedef void (__cdecl *ACE_SignalHandlerV)(int);
+ using ACE_SignalHandler = void (__cdecl *)(int);
+ using ACE_SignalHandlerV = void (__cdecl *)(int);
#elif defined (INTEGRITY)
- typedef void (*ACE_SignalHandler)();
- typedef void (*ACE_SignalHandlerV)(int);
+ using ACE_SignalHandler = void (*)();
+ using ACE_SignalHandlerV = void (*)(int);
#elif defined (ACE_HAS_RTEMS)
- typedef void (*ACE_SignalHandler)();
- typedef void (*ACE_SignalHandlerV)();
+ using ACE_SignalHandler = void (*)();
+ using ACE_SignalHandlerV = void (*)();
#else /* This is necessary for some older broken version of cfront */
# if defined (SIG_PF)
# define ACE_SignalHandler SIG_PF
# else
- typedef void (*ACE_SignalHandler)(int);
+ using ACE_SignalHandler = void (*)(int);
# endif /* SIG_PF */
- typedef void (*ACE_SignalHandlerV)(...);
+ using ACE_SignalHandlerV = void (*)(...);
#endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */
#if defined (ACE_LACKS_SIGACTION)