diff options
-rw-r--r-- | ace/OS.h | 2 | ||||
-rw-r--r-- | ace/OS.i | 2 | ||||
-rw-r--r-- | ace/Signal.cpp | 17 | ||||
-rw-r--r-- | ace/Signal.h | 10 | ||||
-rw-r--r-- | ace/Signal.i | 7 | ||||
-rw-r--r-- | ace/Timer_Queue_T.cpp | 24 | ||||
-rw-r--r-- | ace/config-unixware-2.1.2-g++.h | 2 | ||||
-rw-r--r-- | tests/Async_Timer_Queue_Test.cpp | 55 | ||||
-rw-r--r-- | tests/test_config.h | 2 |
9 files changed, 84 insertions, 37 deletions
@@ -3158,7 +3158,7 @@ public: // = A set of wrappers for operations on time. static double difftime (time_t t1, time_t t0); - static time_t time (time_t *tloc); + static time_t time (time_t *tloc = 0); static time_t mktime (struct tm *timeptr); static struct tm *localtime (const time_t *clock); static struct tm *localtime_r (const time_t *clock, @@ -1816,7 +1816,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, if (timeout != 0) ts = *timeout; // Calls ACE_Time_Value::operator timespec_t(). -#if (defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS)) && !defined (ACE_HAS_FSU_PTHREADS) +#if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) # if defined (ACE_HAS_DCE_DRAFT4_THREADS) || defined (ACE_HAS_FSU_PTHREADS) ACE_OSCALL (timeout == 0 ? ::pthread_cond_wait (cv, external_mutex) diff --git a/ace/Signal.cpp b/ace/Signal.cpp index 9812a08624b..6b4d69a7af5 100644 --- a/ace/Signal.cpp +++ b/ace/Signal.cpp @@ -108,6 +108,23 @@ ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, } ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, + ACE_Sig_Set &sig_mask, + int sig_flags) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = sig_flags; + + // Structure assignment... + this->sa_.sa_mask = sig_mask.sigset (); + +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ +} + +ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, int signum, sigset_t *sig_mask, int sig_flags) diff --git a/ace/Signal.h b/ace/Signal.h index 16bc176bfa7..164fbd4c39a 100644 --- a/ace/Signal.h +++ b/ace/Signal.h @@ -45,7 +45,7 @@ public: // Create a set that includes all signals defined by the system. int sig_add (int signo); - // Adds the individual signal specified by <signo> to the set. + // Adds the individual signal specified by <signo> to the set. int sig_del (int signo); // Deletes the individual signal specified by <signo> from the set. @@ -54,7 +54,10 @@ public: // Checks whether the signal specified by <signo> is in the set. operator sigset_t *(); - // Returns a pointer to the underlying sigset_t. + // Returns a pointer to the underlying <sigset_t>. + + sigset_t sigset (void); + // Returns a copy of the underlying <sigset_t>. void dump (void) const; // Dump the state of an object. @@ -78,6 +81,9 @@ public: sigset_t *sigmask = 0, int flags = 0); ACE_Sig_Action (ACE_SignalHandler handler, + ACE_Sig_Set &sigmask, + int flags = 0); + ACE_Sig_Action (ACE_SignalHandler handler, int signum, sigset_t *sigmask = 0, int flags = 0); diff --git a/ace/Signal.i b/ace/Signal.i index 5c37e534f72..2dbcf710238 100644 --- a/ace/Signal.i +++ b/ace/Signal.i @@ -69,6 +69,13 @@ ACE_Sig_Set::operator sigset_t *(void) return &this->sigset_; } +ACE_INLINE sigset_t +ACE_Sig_Set::sigset (void) +{ + ACE_TRACE ("ACE_Sig_Set::sigset"); + return this->sigset_; +} + ACE_INLINE int ACE_Sig_Action::flags (void) { diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp index 250ab4b0ee7..1d52d885ace 100644 --- a/ace/Timer_Queue_T.cpp +++ b/ace/Timer_Queue_T.cpp @@ -237,11 +237,11 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_ti template <class ACE_LOCK> int ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::timeout (ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, - ACE_LOCK> &timer_queue, - ACE_Event_Handler *handler, - const void *act, - const ACE_Time_Value &cur_time) + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, + ACE_LOCK> &timer_queue, + ACE_Event_Handler *handler, + const void *act, + const ACE_Time_Value &cur_time) { // Upcall to the <handler>s handle_timeout method if (handler->handle_timeout (cur_time, act) == -1) @@ -252,9 +252,9 @@ ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::timeout (ACE_Timer_Queue_T<AC template <class ACE_LOCK> int ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancellation (ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, - ACE_LOCK> &timer_queue, - ACE_Event_Handler *handler) + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, + ACE_LOCK> &timer_queue, + ACE_Event_Handler *handler) { ACE_UNUSED_ARG (timer_queue); @@ -266,10 +266,10 @@ ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancellation (ACE_Timer_Queue template <class ACE_LOCK> int ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::deletion (ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, - ACE_LOCK> &timer_queue, - ACE_Event_Handler *handler, - const void *arg) + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, + ACE_LOCK> &timer_queue, + ACE_Event_Handler *handler, + const void *arg) { ACE_UNUSED_ARG (timer_queue); ACE_UNUSED_ARG (handler); diff --git a/ace/config-unixware-2.1.2-g++.h b/ace/config-unixware-2.1.2-g++.h index 5c6b0092cea..d32bd96a67e 100644 --- a/ace/config-unixware-2.1.2-g++.h +++ b/ace/config-unixware-2.1.2-g++.h @@ -11,7 +11,7 @@ #endif /* ! __ACE_INLINE__ */ #define ACE_NEEDS_SYSTIME_H - +#define ACE_HAS_UALARM #define ACE_HAS_SIZET_SOCKET_LEN #define ACE_HAS_AUTOMATIC_INIT_FINI #define ACE_HAS_CPLUSPLUS_HEADERS diff --git a/tests/Async_Timer_Queue_Test.cpp b/tests/Async_Timer_Queue_Test.cpp index 2c69643ae53..6a00e6869cc 100644 --- a/tests/Async_Timer_Queue_Test.cpp +++ b/tests/Async_Timer_Queue_Test.cpp @@ -18,20 +18,44 @@ // ============================================================================ #include "ace/Profile_Timer.h" -#include "ace/Timer_Queue.h" #include "ace/Timer_List.h" -#include "ace/Timer_Heap.h" -#include "ace/Timer_Wheel.h" -#include "ace/Timer_Hash.h" -#include "ace/Timer_Queue.h" #include "test_config.h" static int lines = 0; +static ACE_Timer_List timer_list; + static void -handler (int i) +handler (int signum) +{ + switch (signum) + { + case SIGALRM: + ACE_DEBUG ((LM_DEBUG, "you've entered %d lines, time = %d\n", lines, ACE_OS::time ())); + break; + case SIGINT: + ACE_DEBUG ((LM_DEBUG, "dumping timer queue\n")); + { + for (ACE_Timer_List_Iterator iter (timer_list); + iter.isdone () == 0; + iter.next ()) + iter.item ()->dump (); + } + break; + } +} + +static char menu[] = +"****\n" +"1) schedule_timer usecs \n" +"2) cancel_timer timer_id\n" +"^C list_timers\n" +"please enter your choice: "; + +static void +parse_buf (char *buf) { - fprintf (stderr, "you've entered %d lines, time = %d\n", lines, time (0)); + ACE_DEBUG ((LM_DEBUG, "===== %s", buf)); } /* sigprocmask (SIG_BLOCK, &ss, 0); @@ -45,30 +69,23 @@ run (u_int delay) ACE_OS::ualarm (delay, delay); - ACE_DEBUG ((LM_DEBUG, - "****\n" - "1) schedule_timer usecs \n" - "2) cancel_timer timer_id\n" - "^C list_timers\n" - "please enter your choice: ")); + ACE_DEBUG ((LM_DEBUG, "%s", menu)); for (;;) { char buf[BUFSIZ]; errno = 0; - if (fgets (buf, sizeof buf, stdin) == 0) + if (ACE_OS::fgets (buf, sizeof buf, stdin) == 0) { - fprintf (stderr, "errno = %d\n", errno); - if (errno != EINTR) break; } else { - fprintf (stderr, "buf = %s\n", buf); lines++; - fprintf (stderr, "please enter your choice: "); + parse_buf (buf); + ACE_DEBUG ((LM_DEBUG, "%s", menu)); } } @@ -80,7 +97,7 @@ main (int argc, char *argv[]) { // ACE_START_TEST ("Timer_Queue_Test"); - u_int delay = argc > 1 ? atoi (argv[1]) : 1000; + u_int delay = argc > 1 ? atoi (argv[1]) : ACE_DEFAULT_USECS; run (delay); diff --git a/tests/test_config.h b/tests/test_config.h index 2d0e1b05a5b..a9e806c3e66 100644 --- a/tests/test_config.h +++ b/tests/test_config.h @@ -128,8 +128,8 @@ do {\ ACE_DEBUG ((LM_DEBUG, "Deleting old log file %s (if any)\n\n", temp)); \ ACE_OS::unlink (temp); - const int ACE_NS_MAX_ENTRIES = 1000; +const int ACE_DEFAULT_USECS = 1000; const int ACE_MAX_TIMERS = 4; const int ACE_MAX_THREADS = 4; const int ACE_MAX_DELAY = 10; |