summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-97b11
-rw-r--r--examples/Timer_Queue/Async_Timer_Queue_Test.cpp42
-rw-r--r--examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp3
-rw-r--r--examples/Timer_Queue/Thread_Timer_Queue_Test.cpp78
-rw-r--r--examples/Timer_Queue/main_async.cpp3
-rw-r--r--examples/Timer_Queue/main_reactor.cpp6
-rw-r--r--examples/Timer_Queue/main_thread.cpp17
7 files changed, 101 insertions, 59 deletions
diff --git a/ChangeLog-97b b/ChangeLog-97b
index bac5f6ca93e..c353ad0c801 100644
--- a/ChangeLog-97b
+++ b/ChangeLog-97b
@@ -1,3 +1,14 @@
+Sat Oct 25 17:41:57 1997 Sergio Flores <sergio@macarena.cs.wustl.edu>
+
+ * examples/Timer_Queue/Thread_Timer_Queue_Test.cpp:
+ * examples/Timer_Queue/Async_Timer_Queue_Test.cpp:
+ * examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp:
+ * examples/Timer_Queue/main_async.cpp:
+ * examples/Timer_Queue/main_reactor.cpp:
+ * examples/Timer_Queue/main_thread.cpp:
+ Added "#pragma instantiate" for template instantiations on
+ platforms that use pragmas instead, like SGI.
+
Sat Oct 25 15:18:34 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
* TAO/tests/IDL_Cubit/Makefile: Enhanced the "realclean" target to
diff --git a/examples/Timer_Queue/Async_Timer_Queue_Test.cpp b/examples/Timer_Queue/Async_Timer_Queue_Test.cpp
index b1af85d4d51..0a347781e85 100644
--- a/examples/Timer_Queue/Async_Timer_Queue_Test.cpp
+++ b/examples/Timer_Queue/Async_Timer_Queue_Test.cpp
@@ -4,12 +4,12 @@
//
// = LIBRARY
// examples
-//
+//
// = FILENAME
// Async_Timer_Queue_Test.cpp
//
// = DESCRIPTION
-// This test exercises the <ACE_Asynch_Timer_Queue_Adapter>
+// This test exercises the <ACE_Asynch_Timer_Queue_Adapter>
// using an <ACE_Timer_Heap>.
//
// = AUTHORS
@@ -24,7 +24,7 @@
#include "Async_Timer_Queue_Test.h"
// Hook method that is called to handle the expiration of a timer.
-int
+int
Async_Timer_Handler::handle_timeout (const ACE_Time_Value &tv,
const void *arg)
{
@@ -104,13 +104,13 @@ Async_Timer_Queue::schedule (u_int microsecs)
// Schedule the timer to run in the future.
long tid = this->tq_.schedule
- (eh,
+ (eh,
0, // Note that our "magic cookie" ACT is always NULL.
ACE_OS::gettimeofday () + tv);
if (tid == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "schedule_timer"));
-}
+}
// Cancel a timer.
@@ -148,7 +148,7 @@ int
Async_Timer_Queue::cancel_timer (void *argument)
{
u_long id = *(int *)argument;
-
+
// Cancel a timer.
Async_Timer_Queue::instance ()->cancel (id);
@@ -183,7 +183,7 @@ Async_Timer_Queue::shutdown_timer (void *argument)
// Handler for the SIGINT and SIGQUIT signals.
-static void
+static void
signal_handler (int signum)
{
ACE_DEBUG ((LM_DEBUG, "handling signal %S\n", signum));
@@ -235,35 +235,35 @@ Async_Timer_Queue_Test_Driver::Async_Timer_Queue_Test_Driver (void)
// displays the menu of options.
-int
+int
Async_Timer_Queue_Test_Driver::display_menu (void)
-{
+{
// The menu of options provided to the user.
- static char menu[] =
+ static char menu[] =
"****\n"
"1) schedule timer <usecs> \n"
"2) cancel timer <timer_id>\n"
"^C list timers\n"
"^\\ exit program\n";
- ACE_DEBUG ((LM_DEBUG, "%s", menu));
+ ACE_DEBUG ((LM_DEBUG, "%s", menu));
- return 0;
+ return 0;
}
// Initializes the test driver.
-int
+int
Async_Timer_Queue_Test_Driver::init (void)
{
typedef Command<Async_Timer_Queue, Async_Timer_Queue::ACTION> COMMAND;
// Initialize <Command> objects with their corresponding <Input_Task> methods.
- ACE_NEW_RETURN (schedule_cmd_,
+ ACE_NEW_RETURN (schedule_cmd_,
COMMAND (*Async_Timer_Queue::instance (),
&Async_Timer_Queue::schedule_timer),
-1);
-
+
ACE_NEW_RETURN (cancel_cmd_,
COMMAND (*Async_Timer_Queue::instance (),
&Async_Timer_Queue::cancel_timer),
@@ -282,12 +282,14 @@ Async_Timer_Queue_Test_Driver::init (void)
register_signal_handlers ();
return 0;
-}
-
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Async_Timer_Queue_Adapter<ACE_Timer_Heap>;
template class Command<Async_Timer_Queue, Async_Timer_Queue::ACTION>;
-template class Timer_Queue_Test_Driver<Async_Timer_Queue *,
- Async_Timer_Queue,
- Async_Timer_Queue::ACTION>;
+template class Timer_Queue_Test_Driver<Async_Timer_Queue *, Async_Timer_Queue, Async_Timer_Queue::ACTION>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Async_Timer_Queue_Adapter<ACE_Timer_Heap>
+#pragma instantiate Command<Async_Timer_Queue, Async_Timer_Queue::ACTION>
+#pragma instantiate Timer_Queue_Test_Driver<Async_Timer_Queue *, Async_Timer_Queue, Async_Timer_Queue::ACTION>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp b/examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp
index 6e73ae5a6e5..77b637e1d3a 100644
--- a/examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp
+++ b/examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp
@@ -210,4 +210,7 @@ Reactor_Timer_Queue_Test_Driver::run_test (void)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class Timer_Queue_Test_Driver <ACE_Timer_Heap, Input_Handler, Input_Handler::ACTION>;
template class Command<Input_Handler, Input_Handler::ACTION>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate Timer_Queue_Test_Driver <ACE_Timer_Heap, Input_Handler, Input_Handler::ACTION>
+#pragma instantiate Command<Input_Handler, Input_Handler::ACTION>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp b/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp
index 9dd234ed617..b97c043be75 100644
--- a/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp
+++ b/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp
@@ -4,17 +4,17 @@
//
// = LIBRARY
// examples
-//
+//
// = FILENAME
// Thread_Timer_Queue_Test.cpp
//
// = DESCRIPTION
-// This test exercises the <ACE_Thread_Timer_Queue_Adapter>
+// This test exercises the <ACE_Thread_Timer_Queue_Adapter>
// using an <ACE_Timer_Heap>.
//
// = AUTHORS
// Carlos O'Ryan and Douglas C. Schmidt
-//
+//
// ============================================================================
#include "ace/Task.h"
@@ -34,7 +34,7 @@ Handler::~Handler (void)
{
}
-void
+void
Handler::set_id (int id)
{
this->id_ = id;
@@ -42,7 +42,7 @@ Handler::set_id (int id)
// This is the method invoked when the Timer expires.
-int
+int
Handler::handle_timeout (const ACE_Time_Value &current_time,
const void *)
{
@@ -52,7 +52,7 @@ Handler::handle_timeout (const ACE_Time_Value &current_time,
// point.
ACE_OS::printf ("\nexpiring timer %d at %u.%07.7u secs\n"
"\tthere was a %u.%07.7u secs delay\n",
- this->id_,
+ this->id_,
current_time.sec (),
current_time.usec (),
delay.sec (), delay.usec ());
@@ -64,7 +64,7 @@ Handler::handle_timeout (const ACE_Time_Value &current_time,
// The handler was cancelled, so we must delete this.
-int
+int
Handler::cancelled (void)
{
delete this;
@@ -75,14 +75,14 @@ Input_Task::Input_Task (Thread_Timer_Queue *queue,
Thread_Timer_Queue_Test_Driver &timer_queue_driver)
: ACE_Task_Base (ACE_Thread_Manager::instance ()),
queue_ (queue),
- usecs_ (ACE_ONE_SECOND_IN_USECS),
+ usecs_ (ACE_ONE_SECOND_IN_USECS),
driver_ (timer_queue_driver)
{
}
// Svc method is called from the thread library to read input from the user.
-int
+int
Input_Task::svc (void)
{
for (;;)
@@ -96,7 +96,7 @@ Input_Task::svc (void)
return 0;
}
-// schedule a new timer. This method will be called from inside the
+// schedule a new timer. This method will be called from inside the
// <Timer_Queue_Test_Driver> class. (see Command pattern)
int
@@ -111,7 +111,7 @@ Input_Task::add_timer (void *argument)
ACE_NEW_RETURN (h, Handler (expire_at), -1);
int id = queue_->schedule (h, 0, expire_at);
-
+
if (id == -1)
ACE_ERROR_RETURN ((LM_ERROR, "schedule failed"), -1);
@@ -124,7 +124,7 @@ Input_Task::add_timer (void *argument)
return 0;
}
-// Cancel a timer. This method will be called from inside the
+// Cancel a timer. This method will be called from inside the
// <Timer_Queue_Test_Driver> class. (see Command pattern)
int
@@ -149,7 +149,7 @@ Input_Task::list_timer (void *argument)
return 0;
}
-// Shutdown the timer queue. Return -1 indicates to the
+// Shutdown the timer queue. Return -1 indicates to the
// <Timer_Queue_Test_Driver> class that we are done.
int
@@ -165,12 +165,12 @@ Input_Task::shutdown_timer (void *argument)
// Cancel the thread timer queue task "voluntarily."
this->queue_->deactivate ();
#endif /* ACE_LACKS_PTHREAD_CANCEL */
-
+
// -1 indicates we are shutting down the application.
return -1;
}
-void
+void
Input_Task::dump (void)
{
ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->queue_->lock ());
@@ -192,39 +192,39 @@ Thread_Timer_Queue_Test_Driver::Thread_Timer_Queue_Test_Driver (void)
{
}
-int
+int
Thread_Timer_Queue_Test_Driver::run_test (void)
{
this->init ();
return 0;
}
-int
+int
Thread_Timer_Queue_Test_Driver::display_menu (void)
-{
- static char menu[] =
+{
+ static char menu[] =
"Usage:\n"
"1 <microseconds>: setups a new timer\n"
"2 <timerid>: removes a timer\n"
"3 : prints timer queue\n"
"4 : exit\n";
-
- ACE_DEBUG ((LM_DEBUG, "%s", menu));
- return 0;
+ ACE_DEBUG ((LM_DEBUG, "%s", menu));
+
+ return 0;
}
-int
+int
Thread_Timer_Queue_Test_Driver::init (void)
{
typedef Command<Input_Task, Input_Task::ACTION> COMMAND;
- // initialize the <Command> objects with their corresponding
+ // initialize the <Command> objects with their corresponding
// methods from <Input_Task>
- ACE_NEW_RETURN (schedule_cmd_,
+ ACE_NEW_RETURN (schedule_cmd_,
COMMAND (input_task_, &Input_Task::add_timer),
-1);
-
+
ACE_NEW_RETURN (cancel_cmd_,
COMMAND (input_task_, &Input_Task::cancel_timer),
-1);
@@ -239,25 +239,31 @@ Thread_Timer_Queue_Test_Driver::init (void)
if (this->input_task_.activate () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "cannot activate input task"), -1);
-
+
if (this->timer_queue_.activate () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "cannot activate timer queue"), -1);
-
+
if (ACE_Thread_Manager::instance ()->wait () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "wait on Thread_Manager failed"),-1);
- return 0;
-}
-
+ return 0;
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Thread_Timer_Queue_Adapter<Timer_Heap>;
template class Timer_Queue_Test_Driver<Thread_Timer_Queue,
Input_Task,
Input_Task::ACTION>;
template class Command<Input_Task, Input_Task::ACTION>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Thread_Timer_Queue_Adapter<Timer_Heap>
+#pragma instantiate Timer_Queue_Test_Driver<Thread_Timer_Queue, \
+ Input_Task, \
+ Input_Task::ACTION>
+#pragma instantiate Command<Input_Task, Input_Task::ACTION>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-#if defined (ACE_MT_SAFE)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// These templates will specialized in libACE.* if the platforms does
// not define ACE_MT_SAFE.
@@ -269,5 +275,13 @@ template class ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_T
template class ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>;
template class ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>;
template class ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Thread_Condition<ACE_Thread_Mutex>
+#pragma instantiate ACE_Condition<ACE_Thread_Mutex>
+#pragma instantiate ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>
+#pragma instantiate ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>
+#pragma instantiate ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>
+#pragma instantiate ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>
+#pragma instantiate ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
#endif /* ACE_MT_SAFE */
diff --git a/examples/Timer_Queue/main_async.cpp b/examples/Timer_Queue/main_async.cpp
index 6ac013feab4..238df6f749e 100644
--- a/examples/Timer_Queue/main_async.cpp
+++ b/examples/Timer_Queue/main_async.cpp
@@ -45,6 +45,9 @@ main (int, char *[])
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class auto_ptr <ASYNC_TIMER_QUEUE_TEST_DRIVER>;
template class ACE_Auto_Basic_Ptr <ASYNC_TIMER_QUEUE_TEST_DRIVER>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate auto_ptr <ASYNC_TIMER_QUEUE_TEST_DRIVER>
+#pragma instantiate ACE_Auto_Basic_Ptr <ASYNC_TIMER_QUEUE_TEST_DRIVER>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/Timer_Queue/main_reactor.cpp b/examples/Timer_Queue/main_reactor.cpp
index 03ab1e39128..d60498a577f 100644
--- a/examples/Timer_Queue/main_reactor.cpp
+++ b/examples/Timer_Queue/main_reactor.cpp
@@ -48,4 +48,10 @@ template class ACE_Auto_Basic_Ptr <REACTOR_TIMER_QUEUE_TEST_DRIVER>;
template class Timer_Queue_Test_Driver<ACE_Timer_Heap *,
Input_Handler,
Input_Handler::ACTION>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate auto_ptr <REACTOR_TIMER_QUEUE_TEST_DRIVER>
+#pragma instantiate ACE_Auto_Basic_Ptr <REACTOR_TIMER_QUEUE_TEST_DRIVER>
+#pragma instantiate Timer_Queue_Test_Driver<ACE_Timer_Heap *, \
+ Input_Handler, \
+ Input_Handler::ACTION>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/examples/Timer_Queue/main_thread.cpp b/examples/Timer_Queue/main_thread.cpp
index e54ae0f3a0e..1eb5b61bbc1 100644
--- a/examples/Timer_Queue/main_thread.cpp
+++ b/examples/Timer_Queue/main_thread.cpp
@@ -4,9 +4,9 @@
//
// = LIBRARY
// examples
-//
+//
// = FILENAME
-// main_thread.cpp
+// main_thread.cpp
//
// = DESCRIPTION
// Implements an threaded timer queue.
@@ -15,15 +15,15 @@
//
// = AUTHORS
// Douglas Schmidt <schmidt@cs.wustl.edu> &&
-// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
-//
+// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
+//
// ============================================================================
#include "ace/Auto_Ptr.h"
#include "Driver.h"
#include "Thread_Timer_Queue_Test.h"
-typedef Timer_Queue_Test_Driver<Thread_Timer_Queue,
+typedef Timer_Queue_Test_Driver<Thread_Timer_Queue,
Input_Task,
Input_Task::ACTION>
THREAD_TIMER_QUEUE_TEST_DRIVER;
@@ -35,14 +35,17 @@ main (int, char *[])
// automatically.
auto_ptr <THREAD_TIMER_QUEUE_TEST_DRIVER> driver;
THREAD_TIMER_QUEUE_TEST_DRIVER *tqtd;
-
+
ACE_NEW_RETURN (tqtd, Thread_Timer_Queue_Test_Driver, -1);
driver = tqtd;
-
+
return driver->run_test ();
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class auto_ptr <THREAD_TIMER_QUEUE_TEST_DRIVER>;
template class ACE_Auto_Basic_Ptr <THREAD_TIMER_QUEUE_TEST_DRIVER>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate auto_ptr <THREAD_TIMER_QUEUE_TEST_DRIVER>
+#pragma instantiate ACE_Auto_Basic_Ptr <THREAD_TIMER_QUEUE_TEST_DRIVER>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */