summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-09-20 00:05:52 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-09-20 00:05:52 +0000
commit573e9c61b65ebf7a9e273470104aa25881136dfd (patch)
treecd23b24636356f773efb2f504a66be50779e160f /ace
parent70504f146a02b904f5e790cd540a8352bf36bb40 (diff)
downloadATCD-573e9c61b65ebf7a9e273470104aa25881136dfd.tar.gz
ChangeLogTag:Fri Sep 19 14:13:07 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'ace')
-rw-r--r--ace/Timer_Queue_T.cpp192
-rw-r--r--ace/Timer_Queue_T.h5
-rw-r--r--ace/config-hpux-10.x-hpc++.h2
-rw-r--r--ace/config-irix6.x-g++.h152
4 files changed, 256 insertions, 95 deletions
diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp
index 5ba383def39..a3bf1455c58 100644
--- a/ace/Timer_Queue_T.cpp
+++ b/ace/Timer_Queue_T.cpp
@@ -65,31 +65,31 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *m
if (this->earliest_time () > cur_time)
{
- // The earliest item on the Timer_Queue is still in the
- // future. Therefore, use the smaller of (1) caller's wait
- // time or (2) the delta time between now and the earliest
- // time on the Timer_Queue.
+ // The earliest item on the Timer_Queue is still in the
+ // future. Therefore, use the smaller of (1) caller's wait
+ // time or (2) the delta time between now and the earliest
+ // time on the Timer_Queue.
this->timeout_ = this->earliest_time () - cur_time;
if (max_wait_time == 0 || *max_wait_time > timeout_)
return &this->timeout_;
- else
- return max_wait_time;
+ else
+ return max_wait_time;
}
- else
+ else
{
- // The earliest item on the Timer_Queue is now in the past.
- // Therefore, we've got to "poll" the Reactor, i.e., it must
- // just check the descriptors and then dispatch timers, etc.
+ // The earliest item on the Timer_Queue is now in the past.
+ // Therefore, we've got to "poll" the Reactor, i.e., it must
+ // just check the descriptors and then dispatch timers, etc.
this->timeout_ = ACE_Time_Value::zero;
- return &this->timeout_;
+ return &this->timeout_;
}
}
}
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Time_Value *
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time,
- ACE_Time_Value *the_timeout)
+ ACE_Time_Value *the_timeout)
{
ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout");
@@ -110,21 +110,21 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *m
if (this->earliest_time () > cur_time)
{
- // The earliest item on the Timer_Queue is still in the
- // future. Therefore, use the smaller of (1) caller's wait
- // time or (2) the delta time between now and the earliest
- // time on the Timer_Queue.
+ // The earliest item on the Timer_Queue is still in the
+ // future. Therefore, use the smaller of (1) caller's wait
+ // time or (2) the delta time between now and the earliest
+ // time on the Timer_Queue.
*the_timeout = this->earliest_time () - cur_time;
if (!(max_wait_time == 0 || *max_wait_time > *the_timeout))
- *the_timeout = *max_wait_time;
+ *the_timeout = *max_wait_time;
}
- else
+ else
{
- // The earliest item on the Timer_Queue is now in the past.
- // Therefore, we've got to "poll" the Reactor, i.e., it must
- // just check the descriptors and then dispatch timers, etc.
- *the_timeout = ACE_Time_Value::zero;
+ // The earliest item on the Timer_Queue is now in the past.
+ // Therefore, we've got to "poll" the Reactor, i.e., it must
+ // just check the descriptors and then dispatch timers, etc.
+ *the_timeout = ACE_Time_Value::zero;
}
}
return the_timeout;
@@ -206,25 +206,25 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_ti
// Check if this is an interval timer.
if (expired->get_interval () > ACE_Time_Value::zero)
- {
- // Make sure that we skip past values that have already
- // "expired".
- do
- expired->set_timer_value (expired->get_timer_value () + expired->get_interval ());
- while (expired->get_timer_value () <= cur_time);
-
- // Since this is an interval timer, we need to reschedule
- // it.
- this->reschedule (expired);
- reclaim = 0;
- }
+ {
+ // Make sure that we skip past values that have already
+ // "expired".
+ do
+ expired->set_timer_value (expired->get_timer_value () + expired->get_interval ());
+ while (expired->get_timer_value () <= cur_time);
+
+ // Since this is an interval timer, we need to reschedule
+ // it.
+ this->reschedule (expired);
+ reclaim = 0;
+ }
// call the functor
this->upcall (type, act, cur_time);
if (reclaim)
- // Call the factory method to free up the node.
- this->free_node (expired);
+ // Call the factory method to free up the node.
+ this->free_node (expired);
number_of_timers_expired++;
@@ -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,24 +252,24 @@ 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);
// Upcall to the <handler>s handle_close method
handler->handle_close (ACE_INVALID_HANDLE,
- ACE_Event_Handler::TIMER_MASK);
+ ACE_Event_Handler::TIMER_MASK);
return 0;
}
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);
@@ -288,7 +288,7 @@ ACE_Async_Timer_Queue_Adapter<TQ>::timer_queue (void)
template <class TQ> int
ACE_Async_Timer_Queue_Adapter<TQ>::cancel (long timer_id,
- const void **act)
+ const void **act)
{
// Block designated signals.
ACE_Sig_Guard sg (&this->mask_);
@@ -307,11 +307,29 @@ ACE_Async_Timer_Queue_Adapter<TQ>::expire (void)
return this->timer_queue_.expire ();
}
+template <class TQ> long
+ACE_Async_Timer_Queue_Adapter<TQ>::schedule_ualarm (void)
+{
+ ACE_Time_Value tv = this->timer_queue_.earliest_time ()
+ - ACE_OS::gettimeofday ();
+
+ // Beware of negative times and zero times (which cause problems for
+ // ualarm()).
+ if (tv < ACE_Time_Value::zero)
+ tv = ACE_Time_Value (0, 1);
+
+ // @@ This code should be clever enough to avoid updating the
+ // ualarm() if we haven't actually changed the earliest time.
+ // Schedule a new timer.
+ ACE_OS::ualarm (tv);
+ return 0;
+}
+
template <class TQ> long
ACE_Async_Timer_Queue_Adapter<TQ>::schedule (ACE_Event_Handler *eh,
- const void *act,
- const ACE_Time_Value &delay,
- const ACE_Time_Value &interval)
+ const void *act,
+ const ACE_Time_Value &delay,
+ const ACE_Time_Value &interval)
{
ACE_UNUSED_ARG (act);
ACE_UNUSED_ARG (interval);
@@ -320,28 +338,13 @@ ACE_Async_Timer_Queue_Adapter<TQ>::schedule (ACE_Event_Handler *eh,
ACE_Sig_Guard sg (&this->mask_);
ACE_UNUSED_ARG (sg);
+ // @@ We need to figure out how to implement interval timers...
long tid = this->timer_queue_.schedule (eh, 0, delay);
if (tid == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1);
- ACE_Time_Value tv = this->timer_queue_.earliest_time ()
- - ACE_OS::gettimeofday ();
-
- ACE_DEBUG ((LM_DEBUG,
- "scheduling timer %d for (%d, %d)\n",
- tid, tv.sec (), tv.usec ()));
-
- // Beware of negative times and zero times (which cause problems for
- // ualarm()).
- if (tv < ACE_Time_Value::zero)
- tv = ACE_Time_Value (0, 1);
-
- // @@ This code should be clever enough to avoid updating the
- // ualarm() if we haven't actually changed the earliest time.
- // Schedule a new timer.
- ACE_OS::ualarm (tv);
- return 0;
+ return this->schedule_ualarm ();
}
template <class TQ>
@@ -355,8 +358,8 @@ ACE_Async_Timer_Queue_Adapter<TQ>::ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *m
// calls that are interrupted by the signals.
ACE_Sig_Action sa ((ACE_SignalHandler) 0,
- this->mask_,
- SA_RESTART);
+ this->mask_,
+ SA_RESTART);
if (this->sig_handler_.register_handler (SIGALRM, this, &sa) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "register_handler"));
@@ -365,10 +368,11 @@ ACE_Async_Timer_Queue_Adapter<TQ>::ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *m
// This is the signal handler function for the asynchronous timer
// list. It gets invoked asynchronously when the SIGALRM signal
// occurs.
+
template <class TQ> int
ACE_Async_Timer_Queue_Adapter<TQ>::handle_signal (int signum,
- siginfo_t *,
- ucontext_t *)
+ siginfo_t *,
+ ucontext_t *)
{
ACE_DEBUG ((LM_DEBUG, "handling signal %S\n", signum));
@@ -376,26 +380,26 @@ ACE_Async_Timer_Queue_Adapter<TQ>::handle_signal (int signum,
{
case SIGALRM:
{
- int expired_timers;
-
- // Expire the pending timers.
- expired_timers = this->timer_queue_.expire ();
-
- if (expired_timers > 0)
- ACE_DEBUG ((LM_DEBUG,
- "time = %d, timers expired = %d\n",
- ACE_OS::time (),
- expired_timers));
-
- // Only schedule a new timer if there is one in the list.
- // @@ This code should also become smarter to avoid
- // unnecessary calls to ualarm().
- if (this->timer_queue_.is_empty () == 0)
- ACE_OS::ualarm (this->timer_queue_.earliest_time ()
- - ACE_OS::gettimeofday ());
-
- return 0;
- /* NOTREACHED */
+ int expired_timers;
+
+ // Expire the pending timers.
+ // @@ We need to figure out how to implement interval timers...
+ expired_timers = this->timer_queue_.expire ();
+
+ if (expired_timers > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "time = %d, timers expired = %d\n",
+ ACE_OS::time (),
+ expired_timers));
+
+ // Only schedule a new timer if there is one in the list.
+ // @@ This code should also become smarter to avoid
+ // unnecessary calls to ualarm().
+ if (this->timer_queue_.is_empty () == 0)
+ return this->schedule_ualarm ();
+ else
+ return 0;
+ /* NOTREACHED */
}
default:
ACE_ERROR_RETURN ((LM_ERROR, "unexpected signal %S\n", signum), -1);
diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h
index e979d1a4c58..ff1b61b0c2c 100644
--- a/ace/Timer_Queue_T.h
+++ b/ace/Timer_Queue_T.h
@@ -387,12 +387,15 @@ public:
// Access the underlying <TIMER_QUEUE>.
private:
+ virtual int schedule_ualarm (void);
+ // Perform the logic to compute the new ualarm(2) setting.
+
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
// Called back by <SIGALRM> handler.
ACE_Sig_Handler sig_handler_;
// Handler for the <SIGALRM> signal, so that we can access our state
- // without requiring global variables.
+ // without requiring any global variables.
TQ timer_queue_;
// Implementation of the timer queue (e.g., <ACE_Timer_List>,
diff --git a/ace/config-hpux-10.x-hpc++.h b/ace/config-hpux-10.x-hpc++.h
index 94a769ff225..b0541c0db31 100644
--- a/ace/config-hpux-10.x-hpc++.h
+++ b/ace/config-hpux-10.x-hpc++.h
@@ -48,6 +48,8 @@
// The HP/UX compiler doesn't support volatile!!!!
# define volatile
+# define ACE_LACKS_SIGNED_CHAR
+
#else // aC++ definitions
// Compiler can't handle calls like foo->operator T *()
diff --git a/ace/config-irix6.x-g++.h b/ace/config-irix6.x-g++.h
new file mode 100644
index 00000000000..f123b0794e0
--- /dev/null
+++ b/ace/config-irix6.x-g++.h
@@ -0,0 +1,152 @@
+/* -*- C++ -*- */
+// $Id$
+
+// The following configuration file is designed to work for the SGI
+// Indigo2EX running Irix 6.2 platform using the GNU C++ Compiler
+
+#if !defined (ACE_CONFIG_H)
+#define ACE_CONFIG_H
+
+// Platform supports the very odd IRIX 6.2 threads...
+#define ACE_HAS_IRIX62_THREADS
+#define ACE_HAS_PTHREAD_SIGMASK
+
+// Needed for the threading stuff?
+#include /**/ <sched.h>
+#include /**/ <task.h>
+#define PTHREAD_MIN_PRIORITY PX_PRIO_MIN
+#define PTHREAD_MAX_PRIORITY PX_PRIO_MAX
+
+// Platform has no implementation of pthread_condattr_setpshared(),
+// even though it supports pthreads! (like Irix 6.2)
+#define ACE_LACKS_CONDATTR_PSHARED
+
+// IRIX 6.2 supports a variant of POSIX Pthreads, supposedly POSIX 1c
+#define ACE_HAS_PTHREADS
+
+// Platforms has pthread_thr_sigsetmask
+#define ACE_HAS_PTHREAD_SIGMASK
+
+// Platform has pthread_equal().
+#define ACE_HAS_PTHREAD_EQUAL
+
+// Platform has pthread_t defined.
+#define ACE_HAS_PTHREAD_T
+
+// Compiler/platform has thread-specific storage
+#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
+// Platform supports getpagesize() call.
+#define ACE_HAS_GETPAGESIZE
+#define ACE_HAS_STRING_CLASS
+#define IRIX6
+#define ACE_HAS_SIGWAIT
+
+#define ACE_TEMPLATES_REQUIRE_SOURCE
+// Optimize ACE_Handle_Set for select().
+#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
+#define ACE_HAS_TEMPLATE_SPECIALIZATION
+#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION
+#define ACE_HAS_BROKEN_EXPLICIT_TEMPLATE_DESTRUCTOR
+
+// Platform supports System V IPC (most versions of UNIX, but not Win32)
+#define ACE_HAS_SYSV_IPC
+
+// Platform requires void * for mmap().
+#define ACE_HAS_VOIDPTR_MMAP
+
+// Platform supports recvmsg and sendmsg.
+#define ACE_HAS_MSG
+
+// Compiler/platform contains the <sys/syscall.h> file.
+#define ACE_HAS_SYSCALL_H
+
+// Compiler/platform supports alloca()
+#define ACE_HAS_ALLOCA
+
+// Compiler/platform has <alloca.h>
+#define ACE_HAS_ALLOCA_H
+
+// IRIX6 needs to define bzero() in this odd file <bstring.h>
+#define ACE_HAS_BSTRING
+
+// Compiler/platform has the getrusage() system call.
+#define ACE_HAS_GETRUSAGE
+
+// Denotes that IRIX 6.2 has second argument to gettimeofday()
+// which is variable ...
+#define ACE_HAS_IRIX_GETTIMEOFDAY
+
+// Denotes that GNU has cstring.h as standard
+// which redefines memchr()
+#define ACE_HAS_GNU_CSTRING_H
+
+// Compiler doesn't support static data member templates.
+#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES
+
+// Platform supports POSIX O_NONBLOCK semantics.
+#define ACE_HAS_POSIX_NONBLOCK
+
+// Platform supports POSIX timers via timestruc_t.
+#define ACE_HAS_POSIX_TIME
+#define ACE_HAS_SVR4_TIME
+#define ACE_NEEDS_SYSTIME_H
+
+// Compiler/platform has correctly prototyped header files.
+#define ACE_HAS_CPLUSPLUS_HEADERS
+
+// Platform contains <poll.h>.
+#define ACE_HAS_POLL
+
+// Platform supports the /proc file system.
+#define ACE_HAS_PROC_FS
+
+// Compiler/platform defines the sig_atomic_t typedef.
+#define ACE_HAS_SIG_ATOMIC_T
+
+// Platform supports SVR4 extended signals.
+#define ACE_HAS_SIGINFO_T
+#define ACE_HAS_UCONTEXT_T
+
+// Compiler supports the ssize_t typedef.
+#define ACE_HAS_SSIZE_T
+
+// Platform supports STREAMS.
+#define ACE_HAS_STREAMS
+
+// Platform supports STREAM pipes (note that this is disabled by
+// default, see the manual page on pipe(2) to find out how to enable
+// it).
+// #define ACE_HAS_STREAM_PIPES
+
+// Compiler/platform supports strerror ().
+#define ACE_HAS_STRERROR
+
+// Compiler/platform supports struct strbuf.
+#define ACE_HAS_STRBUF_T
+
+// Compiler/platform supports SVR4 dynamic linking semantics.
+#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
+// Compiler/platform supports SVR4 signal typedef.
+#define ACE_HAS_IRIX_53_SIGNALS
+
+// Compiler/platform supports sys_siglist array.
+//#define ACE_HAS_SYS_SIGLIST
+
+// Platform provides <sys/filio.h> header.
+#define ACE_HAS_SYS_FILIO_H
+
+// Compiler/platform defines a union semun for SysV shared memory.
+#define ACE_HAS_SEMUN
+
+// Platform supports IP multicast
+#define ACE_HAS_IP_MULTICAST
+
+// Turns off the tracing feature.
+#if !defined (ACE_NTRACE)
+#define ACE_NTRACE 1
+#endif /* ACE_NTRACE */
+
+#endif /* ACE_CONFIG_H */