summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-10-12 19:20:20 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-10-12 19:20:20 +0000
commit2b25b3e3dafc26d6809539dc848a3bb9f7bcc85e (patch)
tree969557ea11ba19f1167c3f49730f50dcffe6e305
parentd85bd1bcd0d71fc620645ccc4a2ddf88ef3219ed (diff)
downloadATCD-2b25b3e3dafc26d6809539dc848a3bb9f7bcc85e.tar.gz
*** empty log message ***
-rw-r--r--ace/Timer_Queue_Adapters.cpp196
-rw-r--r--ace/Timer_Queue_Adapters.h152
-rw-r--r--ace/Timer_Queue_Adapters.i24
-rw-r--r--ace/Timer_Queue_T.cpp190
-rw-r--r--ace/Timer_Queue_T.h120
-rw-r--r--ace/Timer_Queue_T.i20
6 files changed, 372 insertions, 330 deletions
diff --git a/ace/Timer_Queue_Adapters.cpp b/ace/Timer_Queue_Adapters.cpp
new file mode 100644
index 00000000000..1d8edc37f16
--- /dev/null
+++ b/ace/Timer_Queue_Adapters.cpp
@@ -0,0 +1,196 @@
+// $Id$
+
+#if !defined (ACE_TIMER_QUEUE_ADAPTERS_C)
+#define ACE_TIMER_QUEUE_ADAPTERS_C
+
+template <class TQ> TQ &
+ACE_Async_Timer_Queue_Adapter<TQ>::timer_queue (void)
+{
+ return this->timer_queue_;
+}
+
+template <class TQ> int
+ACE_Async_Timer_Queue_Adapter<TQ>::cancel (long timer_id,
+ const void **act)
+{
+ // Block designated signals.
+ ACE_Sig_Guard sg (&this->mask_);
+ ACE_UNUSED_ARG (sg);
+
+ return this->timer_queue_.cancel (timer_id, act);
+}
+
+template <class TQ> int
+ACE_Async_Timer_Queue_Adapter<TQ>::expire (void)
+{
+ // Block designated signals.
+ ACE_Sig_Guard sg (&this->mask_);
+ ACE_UNUSED_ARG (sg);
+
+ return this->timer_queue_.expire ();
+}
+
+template <class TQ> int
+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)
+{
+ ACE_UNUSED_ARG (act);
+ ACE_UNUSED_ARG (interval);
+
+ // Block designated signals.
+ 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);
+
+ return this->schedule_ualarm ();
+}
+
+template <class TQ>
+ACE_Async_Timer_Queue_Adapter<TQ>::ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask)
+ // If <mask> == 0, block *all* signals when the SIGARLM handler is
+ // running, else just block those in the mask.
+ : mask_ (mask)
+{
+ // The following code is necessary to selectively "block" certain
+ // signals when SIGALRM is running. Also, we always restart system
+ // calls that are interrupted by the signals.
+
+ ACE_Sig_Action sa ((ACE_SignalHandler) 0,
+ this->mask_,
+ SA_RESTART);
+
+ if (this->sig_handler_.register_handler (SIGALRM, this, &sa) == -1)
+ ACE_ERROR ((LM_ERROR, "%p\n", "register_handler"));
+}
+
+// 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 *)
+{
+ ACE_DEBUG ((LM_DEBUG, "handling signal %S\n", signum));
+
+ switch (signum)
+ {
+ case SIGALRM:
+ {
+ 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);
+ /* NOTREACHED */
+ }
+}
+
+template<class TQ> long
+ACE_Thread_Timer_Queue_Adapter<TQ>::schedule
+ (ACE_Event_Handler* handler,
+ const void *act,
+ const ACE_Time_Value &delay,
+ const ACE_Time_Value &interval = ACE_Time_Value::zero)
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
+
+ long result = this->timer_queue_.schedule (handler, act, delay, interval);
+ this->condition_.signal ();
+ return result;
+}
+
+template<class TQ> int
+ACE_Thread_Timer_Queue_Adapter<TQ>::cancel (long timer_id,
+ const void **act)
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
+
+ int result = this->timer_queue_.cancel (timer_id, act);
+ condition_.signal ();
+ return result;
+}
+
+template<class TQ> void
+ACE_Thread_Timer_Queue_Adapter<TQ>::deactivate (void)
+{
+ ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_);
+
+ this->active_ = 0;
+ this->condition_.signal ();
+}
+
+template<class TQ> int
+ACE_Thread_Timer_Queue_Adapter<TQ>::svc (void)
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
+
+ while (this->active_)
+ {
+ // If the queue is empty, sleep until there is a change on it.
+ if (this->timer_queue_.is_empty ())
+ this->condition_.wait ();
+ else
+ {
+ // Compute the remaining time, being careful not to sleep
+ // for "negative" amounts of time.
+ ACE_Time_Value tv = this->timer_queue_.earliest_time ();
+
+ // ACE_DEBUG ((LM_DEBUG, "waiting until %u.%3.3u secs\n",
+ // tv.sec(), tv.msec()));
+ this->condition_.wait (&tv);
+ }
+
+ // Expire timers anyway, at worst this is a no-op.
+ this->timer_queue_.expire ();
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "terminating dispatching thread\n"));
+ return 0;
+}
+
+#endif /* ACE_TIMER_QUEUE_ADAPTERS_C*/
diff --git a/ace/Timer_Queue_Adapters.h b/ace/Timer_Queue_Adapters.h
new file mode 100644
index 00000000000..a5c8d1d7776
--- /dev/null
+++ b/ace/Timer_Queue_Adapters.h
@@ -0,0 +1,152 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// Timer_Queue_Adapters.h
+//
+// = AUTHOR
+// Douglas C. Schmidt and Carlos O'Ryan
+//
+// ============================================================================
+
+#if !defined (ACE_TIMER_QUEUE_ADAPTERS_H)
+#define ACE_TIMER_QUEUE_ADAPTERS_H
+
+#include "ace/Task.h"
+#include "ace/Signal.h"
+
+template <class TQ>
+class ACE_Async_Timer_Queue_Adapter : public ACE_Event_Handler
+ // = TITLE
+ // Adapts a <TQ> to be run asynchronously.
+ //
+ // = DESCRIPTION
+ // This implementation uses the <ualarm> call, which generates
+ // the SIGARLM signal that is caught by this class.
+{
+public:
+ typedef TQ TIMER_QUEUE;
+
+ ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask = 0);
+ // Register the SIGALRM handler. If <mask> == 0 then block all
+ // signals when <SIGALRM> is run. Otherwise, just block the signals
+ // indicated in <mask>.
+
+ long schedule (ACE_Event_Handler *type,
+ const void *act,
+ const ACE_Time_Value &delay,
+ const ACE_Time_Value &interval = ACE_Time_Value::zero);
+ // Schedule the timer according to the semantics of the
+ // <ACE_Timer_List>. However, this timer gets dispatched via a
+ // signal, rather than by a user calling <expire>.
+
+ int cancel (long timer_id, const void **act = 0);
+ // Cancel the <timer_id> and pass back the <act> if an address is
+ // passed in.
+
+ int expire (void);
+ // Dispatch all timers whose values are <= <cur_time>. Returns the
+ // number of timers canceled.
+
+ TQ &timer_queue (void);
+ // 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 any global variables.
+
+ TQ timer_queue_;
+ // Implementation of the timer queue (e.g., <ACE_Timer_List>,
+ // <ACE_Timer_Heap>, etc.).
+
+ ACE_Sig_Set mask_;
+ // Mask of signals to be blocked when we're servicing <SIGALRM>.
+};
+
+template <class TQ>
+class ACE_Thread_Timer_Queue_Adapter : public ACE_Task_Base
+ // = TITLE
+ // Adapts a Timer_Queue using a separate thread for dispatching.
+ //
+ // = DESCRIPTION
+ // This implementation of a Timer_Queue uses a separate thread to
+ // dispatch the timers. The base queue need not be thread safe,
+ // this class takes all the necessary locks.
+ //
+ // = NOTE
+ // This is a case were template parameters will be useful, but
+ // (IMHO) the effort and portability problems discourage their
+ // use.
+{
+public:
+ typedef TQ TIMER_QUEUE;
+
+ ACE_Thread_Timer_Queue_Adapter (void);
+ // Creates the timer queue. Activation of the task is the user's
+ // responsibility.
+
+ long schedule (ACE_Event_Handler* handler,
+ const void *act,
+ const ACE_Time_Value &delay,
+ const ACE_Time_Value &interval = ACE_Time_Value::zero);
+ // Schedule the timer according to the semantics of the <TQ>; wakes
+ // up the dispatching thread.
+
+ int cancel (long timer_id, const void **act = 0);
+ // Cancel the <timer_id> add return the <act> parameter if an
+ // address is passed in. Also wakes up the dispatching thread.
+
+ virtual int svc (void);
+ // Runs the dispatching thread.
+
+ virtual void deactivate (void);
+ // Inform the dispatching thread that it should terminate.
+
+ ACE_SYNCH_MUTEX &lock (void);
+ // Access the locking mechanism, useful for iteration.
+
+ TQ &timer_queue (void);
+ // Access the implementation queue, useful for iteration.
+
+private:
+ TQ timer_queue_;
+ // The underlying Timer_Queue.
+
+ ACE_SYNCH_CONDITION<ACE_SYNCH_MUTEX> condition_;
+ // The dispatching thread sleeps on this condition while waiting to
+ // dispatch the next timer; it is used to wake it up if there is a
+ // change on the timer queue.
+
+ ACE_SYNCH_MUTEX lock_;
+ // The mutual exclusion mechanism which is required to use the
+ // <condition_>.
+
+ int active_;
+ // When deactive is called this variable turns to false and the
+ // dispatching thread is signalled, to terminate its main loop.
+};
+
+#if defined (__ACE_INLINE__)
+#include "ace/Timer_Queue_Adapters.i"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "ace/Timer_Queue_Adapters.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Timer_Queue_Adapters.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#endif /* ACE_TIMER_QUEUE_ADAPTERS_H */
diff --git a/ace/Timer_Queue_Adapters.i b/ace/Timer_Queue_Adapters.i
new file mode 100644
index 00000000000..bc2cceecc25
--- /dev/null
+++ b/ace/Timer_Queue_Adapters.i
@@ -0,0 +1,24 @@
+// $Id$
+
+/* -*- C++ -*- */
+
+template<class TQ> ACE_INLINE
+ACE_Thread_Timer_Queue_Adapter<TQ>::ACE_Thread_Timer_Queue_Adapter (void)
+ : ACE_Task_Base (ACE_Thread_Manager::instance ()),
+ condition_ (lock_)
+{
+ // Assume that we start in active mode.
+ active_ = 1;
+}
+
+template<class TQ> ACE_INLINE ACE_SYNCH_MUTEX &
+ACE_Thread_Timer_Queue_Adapter<TQ>::lock (void)
+{
+ return lock_;
+}
+
+template<class TQ> ACE_INLINE TQ &
+ACE_Thread_Timer_Queue_Adapter<TQ>::timer_queue (void)
+{
+ return timer_queue_;
+}
diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp
index 857bf6a54ac..df992aab5ed 100644
--- a/ace/Timer_Queue_T.cpp
+++ b/ace/Timer_Queue_T.cpp
@@ -280,194 +280,4 @@ ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::deletion (ACE_Timer_Queue_T<A
return 0;
}
-template <class TQ> TQ &
-ACE_Async_Timer_Queue_Adapter<TQ>::timer_queue (void)
-{
- return this->timer_queue_;
-}
-
-template <class TQ> int
-ACE_Async_Timer_Queue_Adapter<TQ>::cancel (long timer_id,
- const void **act)
-{
- // Block designated signals.
- ACE_Sig_Guard sg (&this->mask_);
- ACE_UNUSED_ARG (sg);
-
- return this->timer_queue_.cancel (timer_id, act);
-}
-
-template <class TQ> int
-ACE_Async_Timer_Queue_Adapter<TQ>::expire (void)
-{
- // Block designated signals.
- ACE_Sig_Guard sg (&this->mask_);
- ACE_UNUSED_ARG (sg);
-
- return this->timer_queue_.expire ();
-}
-
-template <class TQ> int
-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)
-{
- ACE_UNUSED_ARG (act);
- ACE_UNUSED_ARG (interval);
-
- // Block designated signals.
- 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);
-
- return this->schedule_ualarm ();
-}
-
-template <class TQ>
-ACE_Async_Timer_Queue_Adapter<TQ>::ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask)
- // If <mask> == 0, block *all* signals when the SIGARLM handler is
- // running, else just block those in the mask.
- : mask_ (mask)
-{
- // The following code is necessary to selectively "block" certain
- // signals when SIGALRM is running. Also, we always restart system
- // calls that are interrupted by the signals.
-
- ACE_Sig_Action sa ((ACE_SignalHandler) 0,
- this->mask_,
- SA_RESTART);
-
- if (this->sig_handler_.register_handler (SIGALRM, this, &sa) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "register_handler"));
-}
-
-// 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 *)
-{
- ACE_DEBUG ((LM_DEBUG, "handling signal %S\n", signum));
-
- switch (signum)
- {
- case SIGALRM:
- {
- 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);
- /* NOTREACHED */
- }
-}
-
-template<class TQ> long
-ACE_Thread_Timer_Queue_Adapter<TQ>::schedule
- (ACE_Event_Handler* handler,
- const void *act,
- const ACE_Time_Value &delay,
- const ACE_Time_Value &interval = ACE_Time_Value::zero)
-{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
-
- long result = this->timer_queue_.schedule (handler, act, delay, interval);
- this->condition_.signal ();
- return result;
-}
-
-template<class TQ> int
-ACE_Thread_Timer_Queue_Adapter<TQ>::cancel (long timer_id,
- const void **act)
-{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
-
- int result = this->timer_queue_.cancel (timer_id, act);
- condition_.signal ();
- return result;
-}
-
-template<class TQ> void
-ACE_Thread_Timer_Queue_Adapter<TQ>::deactivate (void)
-{
- ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_);
-
- this->active_ = 0;
- this->condition_.signal ();
-}
-
-template<class TQ> int
-ACE_Thread_Timer_Queue_Adapter<TQ>::svc (void)
-{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1);
-
- while (this->active_)
- {
- // If the queue is empty, sleep until there is a change on it.
- if (this->timer_queue_.is_empty ())
- this->condition_.wait ();
- else
- {
- // Compute the remaining time, being careful not to sleep
- // for "negative" amounts of time.
- ACE_Time_Value tv = this->timer_queue_.earliest_time ();
-
- // ACE_DEBUG ((LM_DEBUG, "waiting until %u.%3.3u secs\n",
- // tv.sec(), tv.msec()));
- this->condition_.wait (&tv);
- }
-
- // Expire timers anyway, at worst this is a no-op.
- this->timer_queue_.expire ();
- }
-
- ACE_DEBUG ((LM_DEBUG, "terminating dispatching thread\n"));
- return 0;
-}
-
#endif /* ACE_TIMER_QUEUE_T_C*/
diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h
index ee6140788db..795a71165b6 100644
--- a/ace/Timer_Queue_T.h
+++ b/ace/Timer_Queue_T.h
@@ -19,8 +19,6 @@
#define ACE_TIMER_QUEUE_T_H
#include "ace/Free_List.h"
-#include "ace/Signal.h"
-#include "ace/Task.h"
// This should be nested within the ACE_Timer_Queue class but some C++
// compilers still don't like this...
@@ -350,124 +348,6 @@ public:
// the timer is still contained in it
};
-template <class TQ>
-class ACE_Async_Timer_Queue_Adapter : public ACE_Event_Handler
- // = TITLE
- // Adapts a <TQ> to be run asynchronously.
- //
- // = DESCRIPTION
- // This implementation uses the <ualarm> call, which generates
- // the SIGARLM signal that is caught by this class.
-{
-public:
- typedef TQ TIMER_QUEUE;
-
- ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask = 0);
- // Register the SIGALRM handler. If <mask> == 0 then block all
- // signals when <SIGALRM> is run. Otherwise, just block the signals
- // indicated in <mask>.
-
- long schedule (ACE_Event_Handler *type,
- const void *act,
- const ACE_Time_Value &delay,
- const ACE_Time_Value &interval = ACE_Time_Value::zero);
- // Schedule the timer according to the semantics of the
- // <ACE_Timer_List>. However, this timer gets dispatched via a
- // signal, rather than by a user calling <expire>.
-
- int cancel (long timer_id, const void **act = 0);
- // Cancel the <timer_id> and pass back the <act> if an address is
- // passed in.
-
- int expire (void);
- // Dispatch all timers whose values are <= <cur_time>. Returns the
- // number of timers canceled.
-
- TQ &timer_queue (void);
- // 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 any global variables.
-
- TQ timer_queue_;
- // Implementation of the timer queue (e.g., <ACE_Timer_List>,
- // <ACE_Timer_Heap>, etc.).
-
- ACE_Sig_Set mask_;
- // Mask of signals to be blocked when we're servicing <SIGALRM>.
-};
-
-template <class TQ>
-class ACE_Thread_Timer_Queue_Adapter : public ACE_Task_Base
- // = TITLE
- // Adapts a Timer_Queue using a separate thread for dispatching.
- //
- // = DESCRIPTION
- // This implementation of a Timer_Queue uses a separate thread to
- // dispatch the timers. The base queue need not be thread safe,
- // this class takes all the necessary locks.
- //
- // = NOTE
- // This is a case were template parameters will be useful, but
- // (IMHO) the effort and portability problems discourage their
- // use.
-{
-public:
- typedef TQ TIMER_QUEUE;
-
- ACE_Thread_Timer_Queue_Adapter (void);
- // Creates the timer queue. Activation of the task is the user's
- // responsibility.
-
- long schedule (ACE_Event_Handler* handler,
- const void *act,
- const ACE_Time_Value &delay,
- const ACE_Time_Value &interval = ACE_Time_Value::zero);
- // Schedule the timer according to the semantics of the <TQ>; wakes
- // up the dispatching thread.
-
- int cancel (long timer_id, const void **act = 0);
- // Cancel the <timer_id> add return the <act> parameter if an
- // address is passed in. Also wakes up the dispatching thread.
-
- virtual int svc (void);
- // Runs the dispatching thread.
-
- virtual void deactivate (void);
- // Inform the dispatching thread that it should terminate.
-
- ACE_SYNCH_MUTEX &lock (void);
- // Access the locking mechanism, useful for iteration.
-
- TQ &timer_queue (void);
- // Access the implementation queue, useful for iteration.
-
-private:
- TQ timer_queue_;
- // The underlying Timer_Queue.
-
- ACE_SYNCH_CONDITION<ACE_SYNCH_MUTEX> condition_;
- // The dispatching thread sleeps on this condition while waiting to
- // dispatch the next timer; it is used to wake it up if there is a
- // change on the timer queue.
-
- ACE_SYNCH_MUTEX lock_;
- // The mutual exclusion mechanism which is required to use the
- // <condition_>.
-
- int active_;
- // When deactive is called this variable turns to false and the
- // dispatching thread is signalled, to terminate its main loop.
-};
-
#if defined (__ACE_INLINE__)
#include "ace/Timer_Queue_T.i"
#endif /* __ACE_INLINE__ */
diff --git a/ace/Timer_Queue_T.i b/ace/Timer_Queue_T.i
index 2c5912d0cdf..a9ea60fbe37 100644
--- a/ace/Timer_Queue_T.i
+++ b/ace/Timer_Queue_T.i
@@ -175,23 +175,3 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall_functor (void)
return *this->upcall_functor_;
}
-template<class TQ> ACE_INLINE
-ACE_Thread_Timer_Queue_Adapter<TQ>::ACE_Thread_Timer_Queue_Adapter (void)
- : ACE_Task_Base (ACE_Thread_Manager::instance ()),
- condition_ (lock_)
-{
- // Assume that we start in active mode.
- active_ = 1;
-}
-
-template<class TQ> ACE_INLINE ACE_SYNCH_MUTEX &
-ACE_Thread_Timer_Queue_Adapter<TQ>::lock (void)
-{
- return lock_;
-}
-
-template<class TQ> ACE_INLINE TQ &
-ACE_Thread_Timer_Queue_Adapter<TQ>::timer_queue (void)
-{
- return timer_queue_;
-}