summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Conn_Test.cpp102
-rw-r--r--tests/Future_Test.cpp128
-rw-r--r--tests/Handle_Set_Test.cpp41
-rw-r--r--tests/Hash_Map_Manager_Test.cpp15
-rw-r--r--tests/IOStream_Test.cpp58
-rw-r--r--tests/Map_Manager_Test.cpp35
-rw-r--r--tests/Message_Block_Test.cpp75
-rw-r--r--tests/Message_Queue_Test.cpp22
-rw-r--r--tests/Process_Strategy_Test.cpp94
-rw-r--r--tests/Reader_Writer_Test.cpp55
-rw-r--r--tests/SV_Shared_Memory_Test.cpp18
-rw-r--r--tests/Service_Config_Test.cpp9
-rw-r--r--tests/Simple_Message_Block_Test.cpp33
-rw-r--r--tests/TSS_Test.cpp29
-rw-r--r--tests/Thread_Pool_Test.cpp61
15 files changed, 440 insertions, 335 deletions
diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp
index e073aba4b57..3f5f03d8ed7 100644
--- a/tests/Conn_Test.cpp
+++ b/tests/Conn_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Conn_Test.cpp
//
@@ -18,7 +18,7 @@
//
// = AUTHOR
// Doug Schmidt, Chris Cleeland
-//
+//
// ============================================================================
#include "ace/SOCK_Connector.h"
@@ -52,12 +52,12 @@ Svc_Handler::in_use (int use)
int
Svc_Handler::open (void *)
{
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) opening Svc_Handler %d with handle\n",
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) opening Svc_Handler %d with handle\n",
this, this->peer ().get_handle ()));
// Enable non-blocking I/O.
if (this->peer ().enable (ACE_NONBLOCK) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "enable"), -1);
-
+
return 0;
}
@@ -65,9 +65,9 @@ void
Svc_Handler::send_data (void)
{
// Send data to server.
-
+
for (char *c = ACE_ALPHABET; *c != '\0'; c++)
- if (this->peer ().send_n (c, 1) == -1)
+ if (this->peer ().send_n (c, 1) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "send_n"));
}
@@ -82,7 +82,7 @@ Svc_Handler::recv_data (void)
char *t = ACE_ALPHABET;
// Read data from client (terminate on error).
-
+
for (ssize_t r_bytes; ;)
{
// Since we're in non-blocking mode we need to use <select>
@@ -110,7 +110,7 @@ Svc_Handler::recv_data (void)
if (r_bytes == 0)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) reached end of input, connection closed by client\n"));
// Handshake back with client.
@@ -119,14 +119,14 @@ Svc_Handler::recv_data (void)
// Close endpoint handle (but don't close <this> yet since
// we're going to recycle it for the next iteration).
- if (new_stream.close () == -1)
+ if (new_stream.close () == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "close"));
break;
}
else if (r_bytes == -1)
{
if (errno == EWOULDBLOCK)
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) no input available, going back to reading\n"));
else
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "recv_n"));
@@ -167,7 +167,7 @@ ACE_Hash_Addr<ACE_INET_Addr, Svc_Handler>::hash_i (const ACE_INET_Addr &addr) co
}
int
-ACE_Hash_Addr<ACE_INET_Addr, Svc_Handler>::compare_i (const ACE_INET_Addr &a1,
+ACE_Hash_Addr<ACE_INET_Addr, Svc_Handler>::compare_i (const ACE_INET_Addr &a1,
const ACE_INET_Addr &a2) const
{
return a1 != a2;
@@ -194,7 +194,7 @@ nonblocking_connect (CONNECTOR &con, const ACE_INET_Addr &server_addr)
ACE_NEW (svc_handler[1], Svc_Handler);
ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting non-blocking connect\n"));
-
+
// Perform a non-blocking connect to the server (this should connect
// immediately since we're in the same address space or same host).
if (con.connect (svc_handler[0], server_addr, options) == -1
@@ -211,7 +211,7 @@ nonblocking_connect (CONNECTOR &con, const ACE_INET_Addr &server_addr)
// Close the connection completely.
if (svc_handler[0]->close (1) == -1
- || svc_handler[1]->close (1) == -1)
+ || svc_handler[1]->close (1) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "close"));
}
@@ -223,7 +223,7 @@ blocking_connect (CONNECTOR &con, const ACE_INET_Addr &server_addr)
ACE_NEW (svc_handler[1], Svc_Handler);
ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting blocking connect\n"));
-
+
// Perform a blocking connect to the server.
if (con.connect (svc_handler[0], server_addr) == -1
|| con.connect (svc_handler[1], server_addr) == -1)
@@ -239,7 +239,7 @@ blocking_connect (CONNECTOR &con, const ACE_INET_Addr &server_addr)
// Close the connection completely.
if (svc_handler[0]->close (1) == -1
- || svc_handler[1]->close (1) == -1)
+ || svc_handler[1]->close (1) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "close"));
}
@@ -259,7 +259,7 @@ dump_map (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_Null_Mutex> &hashmap)
{
if (hashmap.table_[slot] == hashmap.sentinel_)
continue;
-
+
ACE_DEBUG ((LM_DEBUG, "slot %-4d: ", slot));
for (MAP_ENTRY *temp = hashmap.table_[slot];
@@ -270,8 +270,8 @@ dump_map (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_Null_Mutex> &hashmap)
INT_ID& val = temp->int_id_;
ACE_DEBUG ((LM_DEBUG, "(%s,%d,%sin use,0x%p), ",
- key.get_host_name (),
- key.get_port_number (),
+ key.get_host_name (),
+ key.get_port_number (),
val->in_use() ? "" : "not ", val));
}
@@ -284,7 +284,7 @@ dump_map (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_Null_Mutex> &hashmap)
static void
dump (STRAT_CONNECTOR &con)
{
- CACHED_CONNECT_STRATEGY* csp =
+ CACHED_CONNECT_STRATEGY* csp =
(CACHED_CONNECT_STRATEGY *) con.connect_strategy_;
dump_map (csp->connection_cache_);
@@ -304,7 +304,7 @@ cached_connect (STRAT_CONNECTOR &con, const ACE_INET_Addr &server_addr)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting cached blocking connect\n"));
// Initiate timed, non-blocking connection with server.
-
+
// Perform a blocking connect to the server using the Strategy
// Connector with a connection caching strategy. Since we are
// connecting to the same <server_addr> these calls will return the
@@ -354,12 +354,12 @@ client (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
// Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
+ ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg;
- ACE_INET_Addr server_addr (remote_addr->get_port_number (),
+ ACE_INET_Addr server_addr (remote_addr->get_port_number (),
ACE_DEFAULT_SERVER_HOST);
CONNECTOR connector;
@@ -368,7 +368,7 @@ client (void *arg)
// connection.
CACHED_CONNECT_STRATEGY caching_connect_strategy;
- STRAT_CONNECTOR strat_connector (0,
+ STRAT_CONNECTOR strat_connector (0,
&creation_strategy,
&caching_connect_strategy);
@@ -390,7 +390,7 @@ server (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
// Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
+ ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
@@ -403,29 +403,29 @@ server (void *arg)
ACE_NEW_RETURN (svc_handler, Svc_Handler, 0);
// Create a new <Svc_Handler> to consume the data.
-
+
int result;
- while ((result = acceptor->accept (svc_handler,
+ while ((result = acceptor->accept (svc_handler,
&cli_addr,
options)) != -1)
{
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) client %s connected from %d\n",
- cli_addr.get_host_name (),
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) client %s connected from %d\n",
+ cli_addr.get_host_name (),
cli_addr.get_port_number ()));
-
+
svc_handler->recv_data ();
}
if (result == -1)
{
if (errno == ETIMEDOUT)
- ACE_ERROR ((LM_DEBUG,
+ ACE_ERROR ((LM_DEBUG,
"(%P|%t) accept timedout, shutting down\n"));
else
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "accept"));
}
- if (svc_handler->close () == -1)
+ if (svc_handler->close () == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "close"));
return 0;
@@ -444,7 +444,7 @@ main (int, char *[])
if (acceptor.open ((const ACE_INET_Addr &) ACE_Addr::sap_any) == -1
|| acceptor.acceptor ().get_local_addr (server_addr) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "open"));
- else
+ else
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting server at port %d\n",
server_addr.get_port_number ()));
@@ -467,31 +467,31 @@ main (int, char *[])
/* NOTREACHED */
}
#elif defined (ACE_HAS_THREADS)
- if (ACE_Thread_Manager::instance ()->spawn
- (ACE_THR_FUNC (server),
- (void *) &acceptor,
+ if (ACE_Thread_Manager::instance ()->spawn
+ (ACE_THR_FUNC (server),
+ (void *) &acceptor,
THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed"));
- if (ACE_Thread_Manager::instance ()->spawn
- (ACE_THR_FUNC (client),
- (void *) &server_addr,
+ if (ACE_Thread_Manager::instance ()->spawn
+ (ACE_THR_FUNC (client),
+ (void *) &server_addr,
THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed"));
// Wait for the threads to exit.
ACE_Thread_Manager::instance ()->wait ();
#else
- ACE_ERROR ((LM_ERROR,
+ ACE_ERROR ((LM_ERROR,
"(%P|%t) only one thread may be run in a process on this platform\n%a", 1));
-#endif /* ACE_HAS_THREADS */
+#endif /* ACE_HAS_THREADS */
}
ACE_END_TEST;
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Cached_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR, ACE_Null_Mutex>;
template class ACE_Hash_Addr<ACE_INET_Addr, Svc_Handler>;
template class ACE_NOOP_Creation_Strategy<Svc_Handler>;
@@ -508,4 +508,22 @@ template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYN
template class ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>;
template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
template class ACE_Svc_Tuple<Svc_Handler>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Cached_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Addr<ACE_INET_Addr, Svc_Handler>
+#pragma instantiate ACE_NOOP_Creation_Strategy<Svc_Handler>
+#pragma instantiate ACE_Concurrency_Strategy<Svc_Handler>
+#pragma instantiate ACE_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR>
+#pragma instantiate ACE_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>
+#pragma instantiate ACE_Creation_Strategy<Svc_Handler>
+#pragma instantiate ACE_Hash_Map_Entry<ACE_Hash_Addr<ACE_INET_Addr,Svc_Handler>, Svc_Handler *>
+#pragma instantiate ACE_Hash_Map_Manager<ACE_Hash_Addr<ACE_INET_Addr,Svc_Handler>, Svc_Handler *, ACE_Null_Mutex>
+#pragma instantiate ACE_Oneshot_Acceptor<Svc_Handler, ACE_SOCK_ACCEPTOR>
+#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *>
+#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>
+#pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+#pragma instantiate ACE_Svc_Tuple<Svc_Handler>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/Future_Test.cpp b/tests/Future_Test.cpp
index 9071b6bae26..9b3d86bcc6f 100644
--- a/tests/Future_Test.cpp
+++ b/tests/Future_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Future_Test.cpp
//
@@ -14,7 +14,7 @@
// = AUTHOR
// Andres Kruse <Andres.Kruse@cern.ch>, Douglas C. Schmidt
// <schmidt@cs.wustl.edu> and Per Andersson <pera@ipso.se>
-//
+//
// ============================================================================
#include "ace/ACE.h"
@@ -86,21 +86,21 @@ private:
};
Method_Object_work::Method_Object_work (Scheduler* new_Scheduler,
- u_long new_param,
- int new_count,
+ u_long new_param,
+ int new_count,
ACE_Future<u_long> &new_result)
: scheduler_ (new_Scheduler),
param_ (new_param),
count_ (new_count),
future_result_ (new_result)
-{
+{
ACE_DEBUG ((LM_DEBUG,
"(%t) Method_Object_work created\n"));
}
Method_Object_work::~Method_Object_work (void)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) Method_Object_work will be deleted.\n"));
}
@@ -108,8 +108,8 @@ Method_Object_work::~Method_Object_work (void)
int
Method_Object_work::call (void)
{
- return this->future_result_.set
- (this->scheduler_->work_i (this->param_,
+ return this->future_result_.set
+ (this->scheduler_->work_i (this->param_,
this->count_));
}
@@ -118,7 +118,7 @@ class Method_Object_name : public ACE_Method_Object
// Reification of the <name> method.
{
public:
- Method_Object_name (Scheduler *,
+ Method_Object_name (Scheduler *,
ACE_Future<const char*> &);
virtual ~Method_Object_name (void);
virtual int call (void);
@@ -139,7 +139,7 @@ Method_Object_name::Method_Object_name (Scheduler *new_scheduler,
Method_Object_name::~Method_Object_name (void)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) Method_Object_name will be deleted.\n"));
}
@@ -157,9 +157,9 @@ public:
Method_Object_end (Scheduler *new_Scheduler)
: scheduler_ (new_Scheduler) {}
virtual ~Method_Object_end (void) {}
- virtual int call (void) {
- this->scheduler_->close ();
- return -1;
+ virtual int call (void) {
+ this->scheduler_->close ();
+ return -1;
}
private:
@@ -167,56 +167,56 @@ private:
};
// constructor
-Scheduler::Scheduler (const char *newname,
+Scheduler::Scheduler (const char *newname,
Scheduler *new_Scheduler)
{
ACE_NEW (this->name_, char[ACE_OS::strlen (newname) + 1]);
ACE_OS::strcpy ((char *) this->name_, newname);
this->scheduler_ = new_Scheduler;
- ACE_DEBUG ((LM_DEBUG,
- "(%t) Scheduler %s created\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Scheduler %s created\n",
this->name_));
}
// Destructor
Scheduler::~Scheduler (void)
{
- ACE_DEBUG ((LM_DEBUG,
- "(%t) Scheduler %s will be destroyed\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Scheduler %s will be destroyed\n",
this->name_));
delete[] this->name_;
}
// open
-int
+int
Scheduler::open (void *)
{
task_count++;
- ACE_DEBUG ((LM_DEBUG,
- "(%t) Scheduler %s open\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Scheduler %s open\n",
this->name_));
// Become an Active Object.
return this->activate (THR_BOUND);
}
// close
-int
+int
Scheduler::close (u_long)
{
- ACE_DEBUG ((LM_DEBUG,
- "(%t) Scheduler %s close\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Scheduler %s close\n",
this->name_));
task_count--;
return 0;
}
// service..
-int
+int
Scheduler::svc (void)
{
ACE_NEW_THREAD;
- for (;;)
+ for (;;)
{
// Dequeue the next method object (we use an auto pointer in
// case an exception is thrown in the <call>).
@@ -233,7 +233,7 @@ Scheduler::svc (void)
return 0;
}
-void
+void
Scheduler::end (void)
{
this->activation_queue_.enqueue (new Method_Object_end (this));
@@ -242,7 +242,7 @@ Scheduler::end (void)
// Here's where the Work takes place.
u_long
-Scheduler::work_i (u_long param,
+Scheduler::work_i (u_long param,
int count)
{
ACE_UNUSED_ARG (count);
@@ -256,25 +256,25 @@ Scheduler::name_i (void)
return this->name_;
}
-ACE_Future<const char *>
+ACE_Future<const char *>
Scheduler::name (void)
{
- if (this->scheduler_)
+ if (this->scheduler_)
// Delegate to the Scheduler.
return this->scheduler_->name ();
- else
+ else
{
ACE_Future<const char*> new_future;
// @@ What happens if new fails here?
- this->activation_queue_.enqueue
+ this->activation_queue_.enqueue
(new Method_Object_name (this, new_future));
return new_future;
}
}
-ACE_Future<u_long>
+ACE_Future<u_long>
Scheduler::work (u_long newparam, int newcount)
{
if (this->scheduler_) {
@@ -284,7 +284,7 @@ Scheduler::work (u_long newparam, int newcount)
ACE_Future<u_long> new_future;
this->activation_queue_.enqueue
- (new Method_Object_work (this, newparam,
+ (new Method_Object_work (this, newparam,
newcount, new_future));
return new_future;
}
@@ -295,7 +295,7 @@ Scheduler::work (u_long newparam, int newcount)
// Total number of loops.
static int n_loops = 100;
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Future<const char *>;
template class ACE_Future<int>;
template class ACE_Future<u_long>;
@@ -304,19 +304,29 @@ template class ACE_Future_Rep<int>;
template class ACE_Future_Rep<u_long>;
template class auto_ptr<ACE_Method_Object>;
template class auto_basic_ptr<ACE_Method_Object>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Future<const char *>
+#pragma instantiate ACE_Future<int>
+#pragma instantiate ACE_Future<u_long>
+#pragma instantiate ACE_Future_Rep<char const *>
+#pragma instantiate ACE_Future_Rep<int>
+#pragma instantiate ACE_Future_Rep<u_long>
+#pragma instantiate auto_ptr<ACE_Method_Object>
+#pragma instantiate auto_basic_ptr<ACE_Method_Object>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
#endif /* ACE_HAS_THREADS */
int
-main (int, char *[])
+main (int, char *[])
{
ACE_START_TEST ("Future_Test");
#if defined (ACE_HAS_THREADS)
Scheduler *andres = 0, *peter = 0, *helmut = 0, *matias = 0;
- // Create active objects..
+ // Create active objects..
// @@ Should "open" be subsumed within the constructor of
// Scheduler()?
ACE_NEW_RETURN (andres, Scheduler ("andres"), -1);
@@ -330,13 +340,13 @@ main (int, char *[])
ACE_NEW_RETURN (matias, Scheduler ("matias", andres), -1);
matias->open ();
- for (int i = 0; i < n_loops; i++)
+ for (int i = 0; i < n_loops; i++)
{
{
ACE_Future<u_long> fresulta, fresultb, fresultc, fresultd, fresulte;
ACE_Future<const char*> fname;
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) going to do a non-blocking call\n"));
fresulta = andres->work (9013);
@@ -357,7 +367,7 @@ main (int, char *[])
fresulte = fresulta;
- if (i % 3 == 0)
+ if (i % 3 == 0)
{
// Every 3rd time... disconnect the futures...
// but "fresulte" should still contain the result...
@@ -404,7 +414,7 @@ main (int, char *[])
matias->end ();
ACE_OS::sleep (2);
-
+
ACE_DEBUG ((LM_DEBUG,
"(%t) task_count %d future_count %d capsule_count %d methodobject_count %d\n",
(int) task_count,
@@ -416,10 +426,10 @@ main (int, char *[])
// Check if set then get works, older versions of ACE_Future
// will lock forever (or until the timer expires), will use a small
// timer value to avoid blocking the process.
-
+
ACE_Future<int> f1;
f1.set(100);
-
+
ACE_Time_Value timeout(1);
int value = 0;
@@ -441,56 +451,56 @@ main (int, char *[])
ACE_Future<int> f2 (f1); // To ensure that a rep object is created
}
// Now it is one ACE_Future<int> referencing the rep instance
-
+
ACE_DEBUG ((LM_DEBUG, "0.\n"));
//check that self assignment works
- f1 = f1;
+ f1 = f1;
// Is there any repesentation left, and if so what is the ref
// count older ACE_Future<> implementations have deleted the rep
// instance at this moment
-
+
// The stuff below might crash the process if the op=
// implementation was bad
int value = 0;
ACE_Time_Value timeout (1);
- f1.set (100);
+ f1.set (100);
f1.get (value, &timeout);
ACE_DEBUG ((LM_DEBUG, "1.\n"));
- { // Might delete the same data a couple of times
+ { // Might delete the same data a couple of times
ACE_Future<int> f2 (f1);
- f1.set (100);
+ f1.set (100);
f1.get (value, &timeout);
}
ACE_DEBUG ((LM_DEBUG, "2.\n"));
- {
+ {
ACE_Future<int> f2 (f1);
- f1.set (100);
+ f1.set (100);
f1.get (value, &timeout);
}
ACE_DEBUG ((LM_DEBUG, "3.\n"));
- {
+ {
ACE_Future<int> f2 (f1);
- f1.set (100);
+ f1.set (100);
f1.get (value, &timeout);
}
ACE_DEBUG ((LM_DEBUG, "4.\n"));
- {
- ACE_Future<int> f2 (f1);
- f1.set (100);
+ {
+ ACE_Future<int> f2 (f1);
+ f1.set (100);
f1.get (value, &timeout);
}
ACE_DEBUG ((LM_DEBUG, "5.\n"));
- {
+ {
ACE_Future<int> f2 (90);
f2.get (value, &timeout);
f1.get (value, &timeout);
}
}
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"No it did not crash the program.\n"));
ACE_OS::sleep (5);
diff --git a/tests/Handle_Set_Test.cpp b/tests/Handle_Set_Test.cpp
index bb35bc1e12a..3a2df88b3fb 100644
--- a/tests/Handle_Set_Test.cpp
+++ b/tests/Handle_Set_Test.cpp
@@ -4,18 +4,18 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Handle_Set_Test.cpp
//
// = DESCRIPTION
// This test illustrates the use of ACE_Handle_Set to maintain a
// set of handles. No command line arguments are needed to run
-// the test.
+// the test.
//
// = AUTHOR
// Prashant Jain
-//
+//
// ============================================================================
#include "ace/Profile_Timer.h"
@@ -61,18 +61,18 @@ test_duplicates (size_t count)
}
// This is the vector of handles to test. These numbers are chosen to
-// test for boundaries conditions.
-static ACE_HANDLE handle_vector[] =
+// test for boundaries conditions.
+static ACE_HANDLE handle_vector[] =
{
- (ACE_HANDLE) 0,
- (ACE_HANDLE) 1,
- (ACE_HANDLE) 32,
- (ACE_HANDLE) 63,
- (ACE_HANDLE) 64,
- (ACE_HANDLE) 65,
- (ACE_HANDLE) 127,
- (ACE_HANDLE) 128,
- (ACE_HANDLE) 129,
+ (ACE_HANDLE) 0,
+ (ACE_HANDLE) 1,
+ (ACE_HANDLE) 32,
+ (ACE_HANDLE) 63,
+ (ACE_HANDLE) 64,
+ (ACE_HANDLE) 65,
+ (ACE_HANDLE) 127,
+ (ACE_HANDLE) 128,
+ (ACE_HANDLE) 129,
(ACE_HANDLE) 255,
ACE_INVALID_HANDLE
};
@@ -103,7 +103,7 @@ test_boundaries (void)
int count = 0;
- ACE_Handle_Set_Iterator i2 (handle_set);
+ ACE_Handle_Set_Iterator i2 (handle_set);
while ((handle = i2 ()) != ACE_INVALID_HANDLE)
{
@@ -117,7 +117,7 @@ test_boundaries (void)
}
static void
-test_performance (size_t max_handles,
+test_performance (size_t max_handles,
size_t max_iterations)
{
ACE_Handle_Set handle_set;
@@ -177,8 +177,13 @@ main (int argc, char *argv[])
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Unbounded_Queue<ACE_HANDLE>;
template class ACE_Unbounded_Queue_Iterator<ACE_HANDLE>;
template class ACE_Node<ACE_HANDLE>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Unbounded_Queue<ACE_HANDLE>
+#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_HANDLE>
+#pragma instantiate ACE_Node<ACE_HANDLE>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/Hash_Map_Manager_Test.cpp b/tests/Hash_Map_Manager_Test.cpp
index 9c926c4eb11..da82fca94f6 100644
--- a/tests/Hash_Map_Manager_Test.cpp
+++ b/tests/Hash_Map_Manager_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Hash_Map_Manager_Test.cpp
//
@@ -15,7 +15,7 @@
//
// = AUTHOR
// James Hu
-//
+//
// ============================================================================
#include <iostream.h>
@@ -186,7 +186,7 @@ main(void)
// Scoping below so that result of destruction can be seen in the log.
{
HASH_STRING_MAP hash (MAX_HASH);
-
+
hash.bind ("hello", "guten Tag");
hash.bind ("goodbye", "auf wiedersehen");
hash.bind ("funny", "lustig");
@@ -215,8 +215,13 @@ main(void)
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Hash_Map_Entry<MAP_STRING, MAP_STRING>;
template class ACE_Hash_Map_Manager<MAP_STRING, MAP_STRING, ACE_Null_Mutex>;
template class ACE_Hash_Map_Iterator<MAP_STRING, MAP_STRING, ACE_Null_Mutex>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Hash_Map_Entry<MAP_STRING, MAP_STRING>
+#pragma instantiate ACE_Hash_Map_Manager<MAP_STRING, MAP_STRING, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator<MAP_STRING, MAP_STRING, ACE_Null_Mutex>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/IOStream_Test.cpp b/tests/IOStream_Test.cpp
index 2c57de6eec6..5cd3af5f17a 100644
--- a/tests/IOStream_Test.cpp
+++ b/tests/IOStream_Test.cpp
@@ -104,8 +104,8 @@ operator>> (ACE_SOCK_IOStream & stream, qchar *buf)
// if we don't have a quote, append until we see space
if (c != '"')
- for (*buf++ = c;
- (void *) stream.get(c) && !isspace(c);
+ for (*buf++ = c;
+ (void *) stream.get(c) && !isspace(c);
*buf++ = c)
continue;
else
@@ -118,7 +118,7 @@ operator>> (ACE_SOCK_IOStream & stream, qchar *buf)
}
*buf = '\0';
-
+
return stream;
}
@@ -168,13 +168,13 @@ client (void *arg = 0)
ACE_SOCK_IOStream &server = *server_p;
ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg;
- ACE_INET_Addr addr (remote_addr->get_port_number (),
+ ACE_INET_Addr addr (remote_addr->get_port_number (),
ACE_DEFAULT_SERVER_HOST);
ACE_SOCK_Connector connector;
if (connector.connect (server, addr) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%t) %p\n", "Failed to connect to server thread"),
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%t) %p\n", "Failed to connect to server thread"),
0);
// Send a string to the server which it can interpret as a qchar[]
@@ -203,7 +203,7 @@ client (void *arg = 0)
// the server.
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client Receiving\n"));
-
+
int i;
float f1, f2;
long l;
@@ -214,13 +214,13 @@ client (void *arg = 0)
server >> f2;
server >> d;
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) Client Received: int %d float %f long %d float %f double %f\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Client Received: int %d float %f long %d float %f double %f\n",
i, f1, (int) l, f2, d));
// Check for proper received values.
- ACE_ASSERT (i == 1 && (f1 >= 0.123420 && f1 <= 0.123422)
- && l == 666555444 && (f2 >= 23.44 && f2 <= 23.46)
+ ACE_ASSERT (i == 1 && (f1 >= 0.123420 && f1 <= 0.123422)
+ && l == 666555444 && (f2 >= 23.44 && f2 <= 23.46)
&& (d >= -47.1e+9 && d <= -45.9e+9));
// Reset the precision to limit ourselves to two significant digits.
server.precision (2);
@@ -267,16 +267,16 @@ server (void *arg = 0)
#if defined (ACE_HAS_THREADS)
ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
- if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client),
+ if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client),
(void *) &server_addr,
THR_NEW_LWP | THR_DETACHED) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%t) %p\n", "spawing client thread"),
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%t) %p\n", "spawing client thread"),
0);
#endif /* ACE_HAS_THREADS */
if (acceptor->accept (client_handler) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) Failed to accept new client_handler"),
0);
@@ -285,8 +285,8 @@ server (void *arg = 0)
qchar qbuf[BUFSIZ];
ACE_OS::memset (qbuf, 0, sizeof qbuf);
client_handler >> qbuf;
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) Server Received: (\"%s\")\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Server Received: (\"%s\")\n",
qbuf));
// Give the client time to announce the next test to the user.
@@ -300,7 +300,7 @@ server (void *arg = 0)
ACE_OS::memset (buf, 0, sizeof buf);
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Server Received: ("));
- while (ACE_OS::strlen (buf) == 0
+ while (ACE_OS::strlen (buf) == 0
|| buf[ACE_OS::strlen (buf) - 1] != '"')
{
client_handler >> buf;
@@ -333,13 +333,13 @@ server (void *arg = 0)
double d;
client_handler >> i >> f1 >> l >> f2 >> d;
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) Server Received: int %d float %g long %d float %g double %g\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Server Received: int %d float %g long %d float %g double %g\n",
i, f1, (int) l, f2, d));
// check for proper received values
ACE_ASSERT (i == -1 && (f1 >= -0.13 && f1 <= -0.11)
- && l == -666555444 && (f2 >= -24.0 && f2 <= -22.0)
+ && l == -666555444 && (f2 >= -24.0 && f2 <= -22.0)
&& (d >= -45e+9 && d <= 47e+9));
delete client_handler_p;
@@ -359,8 +359,8 @@ spawn (void)
else if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server),
&acceptor,
THR_NEW_LWP | THR_DETACHED) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p\n", "spawning server thread"),
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n", "spawning server thread"),
-1);
// Wait for the client and server thread to exit.
@@ -391,10 +391,10 @@ spawn (void)
break;
}
#else
- ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_ERROR_RETURN ((LM_ERROR,
"threads *and* processes not supported on this platform\n%"),
-1);
-#endif /* ACE_HAS_THREADS */
+#endif /* ACE_HAS_THREADS */
return 0;
}
#endif /* !ACE_LACKS_ACE_IOSTREAM */
@@ -415,8 +415,12 @@ main (int, char *[])
#if !defined (ACE_LACKS_ACE_IOSTREAM)
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_IOStream_T<ACE_SOCK_Stream>;
template class ACE_Streambuf_T<ACE_SOCK_Stream>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_IOStream_T<ACE_SOCK_Stream>
+#pragma instantiate ACE_Streambuf_T<ACE_SOCK_Stream>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
#endif /* !ACE_LACKS_ACE_IOSTREAM */
diff --git a/tests/Map_Manager_Test.cpp b/tests/Map_Manager_Test.cpp
index 913ed65c24b..12707e1d6d5 100644
--- a/tests/Map_Manager_Test.cpp
+++ b/tests/Map_Manager_Test.cpp
@@ -4,18 +4,18 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Map_Manager_Test.cpp
//
// = DESCRIPTION
// This is a simple test of the ACE_Map_Manager and
// ACE_Hash_Map_Manager that illustrates how to use the forward
-// and reverse iterators.
+// and reverse iterators.
//
// = AUTHOR
// Irfan Pyarali and Douglas C. Schmidt
-//
+//
// ============================================================================
#include "ace/Map_Manager.h"
@@ -46,7 +46,7 @@ typedef ACE_Hash_Map_Manager <KEY, VALUE, MUTEX> HASH_MAP_MANAGER;
typedef ACE_Hash_Map_Iterator <KEY, VALUE, MUTEX> HASH_ITERATOR;
typedef ACE_Hash_Map_Entry <KEY, VALUE> HASH_ENTRY;
-static void
+static void
test_hash_map_manager (size_t table_size, size_t iterations)
{
HASH_MAP_MANAGER map (table_size);
@@ -57,7 +57,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
ACE_ASSERT (map.bind (KEY (i), i) != -1);
{
- HASH_ITERATOR iterator (map);
+ HASH_ITERATOR iterator (map);
for (HASH_ENTRY *entry = 0;
iterator.next (entry) != 0;
@@ -97,7 +97,7 @@ test_map_manager (size_t table_size, size_t iterations)
ACE_ASSERT (map.bind (KEY (i), i) != -1);
{
- ITERATOR iterator (map);
+ ITERATOR iterator (map);
for (ENTRY *entry = 0;
iterator.next (entry) != 0;
@@ -144,7 +144,7 @@ test_map_manager (size_t table_size, size_t iterations)
ACE_ASSERT (map.current_size () == 0);
}
-static void
+static void
run_test (void (*ptf) (size_t, size_t),
size_t table_size,
size_t iterations,
@@ -161,16 +161,16 @@ run_test (void (*ptf) (size_t, size_t),
timer.elapsed_time (et);
- ACE_DEBUG ((LM_DEBUG, "time to test a %d item map for %d iterations using %s\n",
+ ACE_DEBUG ((LM_DEBUG, "time to test a %d item map for %d iterations using %s\n",
table_size, iterations, test_name));
ACE_DEBUG ((LM_DEBUG, "real time = %f secs, user time = %f secs, system time = %f secs\n",
et.real_time, et.user_time, et.system_time));
- ACE_DEBUG ((LM_DEBUG, "time per call = %f usecs\n",
+ ACE_DEBUG ((LM_DEBUG, "time per call = %f usecs\n",
(et.real_time / double (iterations)) * 1000000));
}
-int
-main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
ACE_START_TEST ("Map_Manager_Test");
@@ -189,7 +189,7 @@ main (int argc, char *argv[])
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Hash_Map_Manager<KEY, VALUE, MUTEX>;
template class ACE_Hash_Map_Iterator<KEY, VALUE, MUTEX>;
template class ACE_Hash_Map_Entry<KEY, VALUE>;
@@ -197,4 +197,13 @@ template class ACE_Map_Manager<KEY, VALUE, MUTEX>;
template class ACE_Map_Iterator<KEY, VALUE, MUTEX>;
template class ACE_Map_Reverse_Iterator<KEY, VALUE, MUTEX>;
template class ACE_Map_Entry<KEY, VALUE>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Hash_Map_Manager<KEY, VALUE, MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator<KEY, VALUE, MUTEX>
+#pragma instantiate ACE_Hash_Map_Entry<KEY, VALUE>
+#pragma instantiate ACE_Map_Manager<KEY, VALUE, MUTEX>
+#pragma instantiate ACE_Map_Iterator<KEY, VALUE, MUTEX>
+#pragma instantiate ACE_Map_Reverse_Iterator<KEY, VALUE, MUTEX>
+#pragma instantiate ACE_Map_Entry<KEY, VALUE>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/Message_Block_Test.cpp b/tests/Message_Block_Test.cpp
index aaa4830cad8..eb6e027b84a 100644
--- a/tests/Message_Block_Test.cpp
+++ b/tests/Message_Block_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Message_Block_Test.cpp
//
@@ -15,7 +15,7 @@
//
// = AUTHOR
// Doug Schmidt and Nanbor Wang
-//
+//
// ============================================================================
#include "ace/Task.h"
@@ -61,9 +61,9 @@ private:
// Close hook.
};
-int
-Worker_Task::close (u_long)
-{
+int
+Worker_Task::close (u_long)
+{
ACE_DEBUG ((LM_DEBUG, "(%t) close of worker\n"));
return 0;
}
@@ -72,15 +72,15 @@ Worker_Task::close (u_long)
int
Worker_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
-{
- return this->msg_queue ()->enqueue_prio (mb, tv);
+{
+ return this->msg_queue ()->enqueue_prio (mb, tv);
}
// Iterate <n_iterations> printing off a message and "waiting" for all
// other threads to complete this iteration.
-int
-Worker_Task::svc (void)
+int
+Worker_Task::svc (void)
{
ACE_NEW_THREAD;
// The <ACE_Task::svc_run()> method automatically adds us to the
@@ -88,12 +88,12 @@ Worker_Task::svc (void)
// begins.
ACE_DEBUG ((LM_DEBUG, "(%t) starting svc() method\n"));
-
+
// Keep looping, reading a message out of the queue, until we get a
// message with a length == 0, which signals us to quit.
for (int count = 0; ; count++)
- {
+ {
ACE_Message_Block *mb;
ACE_ASSERT (this->msg_queue ()->dequeue_head (mb) != -1);
@@ -117,7 +117,7 @@ Worker_Task::svc (void)
ACE_ASSERT (count == current_count);
- ACE_DEBUG ((LM_DEBUG, "(%t) enqueueing %d duplicates\n",
+ ACE_DEBUG ((LM_DEBUG, "(%t) enqueueing %d duplicates\n",
current_count));
ACE_Message_Block *dup;
@@ -133,8 +133,8 @@ Worker_Task::svc (void)
// threads.
dup->msg_priority (1);
- ACE_ASSERT (this->msg_queue ()->enqueue_prio
- (dup,
+ ACE_ASSERT (this->msg_queue ()->enqueue_prio
+ (dup,
// Don't block indefinitely if we flow control...
(ACE_Time_Value *) &ACE_Time_Value::zero) != -1);
}
@@ -152,11 +152,11 @@ Worker_Task::svc (void)
dup->release ();
}
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) in iteration %d, length = %d, prio = %d, text = \"%*s\"\n",
- count,
- length,
- mb->msg_priority (),
+ count,
+ length,
+ mb->msg_priority (),
length - 2, // remove the trailing "\n\0"
mb->rd_ptr ()));
}
@@ -166,7 +166,7 @@ Worker_Task::svc (void)
if (length == 0)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) in iteration %d, queue len = %d, got NULL message, exiting\n",
count, this->msg_queue ()->message_count ()));
break;
@@ -183,7 +183,7 @@ Worker_Task::Worker_Task (void)
// Make us an Active Object.
if (this->activate (THR_NEW_LWP) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "activate failed"));
-}
+}
static int
produce (Worker_Task &worker_task,
@@ -200,7 +200,7 @@ produce (Worker_Task &worker_task,
int n = ACE_OS::strlen (buf) + 1;
// Allocate a new message.
- ACE_NEW_RETURN (mb,
+ ACE_NEW_RETURN (mb,
ACE_Message_Block (n, // size
ACE_Message_Block::MB_DATA, // type
0, // cont
@@ -214,18 +214,18 @@ produce (Worker_Task &worker_task,
mb->copy (buf, n);
// Pass the message to the Worker_Task.
- if (worker_task.put (mb,
+ if (worker_task.put (mb,
// Don't block indefinitely if we flow control...
(ACE_Time_Value *) &ACE_Time_Value::zero) == -1)
ACE_ERROR ((LM_ERROR, " (%t) %p\n", "put"));
}
// Send a shutdown message to the waiting threads and exit.
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"\n(%t) sending shutdown message\n"));
- ACE_NEW_RETURN (mb,
- ACE_Message_Block (0, ACE_Message_Block::MB_DATA,
+ ACE_NEW_RETURN (mb,
+ ACE_Message_Block (0, ACE_Message_Block::MB_DATA,
0, 0, alloc_strategy, &lock_adapter_),
-1);
@@ -240,7 +240,7 @@ produce (Worker_Task &worker_task,
typedef char MEMORY_CHUNK[ACE_MALLOC_ALIGN * ACE_ALLOC_SIZE];
ACE_Cached_Allocator<MEMORY_CHUNK,
- ACE_SYNCH_MUTEX>
+ ACE_SYNCH_MUTEX>
mem_allocator (ACE_ALLOC_AMOUNT);
struct
@@ -254,7 +254,7 @@ struct
{ &mem_allocator, "Cached Memory" }
};
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Cached_Allocator<MEMORY_CHUNK, ACE_SYNCH_MUTEX>;
template class ACE_Cached_Mem_Pool_Node<MEMORY_CHUNK>;
template class ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<MEMORY_CHUNK>, ACE_SYNCH_MUTEX>;
@@ -262,17 +262,26 @@ template class ACE_Free_List<ACE_Cached_Mem_Pool_Node<MEMORY_CHUNK> >;
template class ACE_Lock_Adapter<ACE_SYNCH_MUTEX>;
template class ACE_Message_Queue_Iterator<ACE_NULL_SYNCH>;
template class ACE_Message_Queue_Reverse_Iterator<ACE_NULL_SYNCH>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Cached_Allocator<MEMORY_CHUNK, ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Cached_Mem_Pool_Node<MEMORY_CHUNK>
+#pragma instantiate ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<MEMORY_CHUNK>, ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Free_List<ACE_Cached_Mem_Pool_Node<MEMORY_CHUNK> >
+#pragma instantiate ACE_Lock_Adapter<ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Message_Queue_Iterator<ACE_NULL_SYNCH>
+#pragma instantiate ACE_Message_Queue_Reverse_Iterator<ACE_NULL_SYNCH>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
#endif /* ACE_HAS_THREADS */
-int
+int
main (int, char *[])
{
ACE_START_TEST ("Message_Block_Test");
#if defined (ACE_HAS_THREADS)
int n_threads = ACE_MAX_THREADS;
-
+
ACE_DEBUG ((LM_DEBUG, "(%t) threads = %d\n", n_threads));
ACE_Profile_Timer ptime;
@@ -287,7 +296,7 @@ main (int, char *[])
// Create the worker tasks.
Worker_Task worker_task[ACE_MAX_THREADS] ;
-
+
// Link all the tasks together into a simple pipeline.
for (int j = 1; j < ACE_MAX_THREADS; j++)
worker_task[j - 1].next (&worker_task[j]);
@@ -297,10 +306,10 @@ main (int, char *[])
produce (worker_task[0], alloc_struct[i].strategy_);
// Wait for all the threads to reach their exit point.
-
+
ACE_DEBUG ((LM_DEBUG,
"(%t) waiting for worker tasks to finish...\n"));
-
+
ACE_Thread_Manager::instance ()->wait ();
ptime.stop ();
ptime.elapsed_time (alloc_struct[i].et_);
diff --git a/tests/Message_Queue_Test.cpp b/tests/Message_Queue_Test.cpp
index d79b9c5af0b..20250e82612 100644
--- a/tests/Message_Queue_Test.cpp
+++ b/tests/Message_Queue_Test.cpp
@@ -4,17 +4,17 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Message_Queue_Test.cpp
//
// = DESCRIPTION
// This is a simple test of the ACE_Message_Queue that
-// illustrates how to use the forward and reverse iterators.
+// illustrates how to use the forward and reverse iterators.
//
// = AUTHOR
// Irfan Pyarali
-//
+//
// ============================================================================
#include "ace/Message_Queue.h"
@@ -25,7 +25,7 @@ typedef ACE_Message_Queue <ACE_NULL_SYNCH> QUEUE;
typedef ACE_Message_Queue_Iterator <ACE_NULL_SYNCH> ITERATOR;
typedef ACE_Message_Queue_Reverse_Iterator <ACE_NULL_SYNCH> REVERSE_ITERATOR;
-int
+int
main (int, char *[])
{
ACE_START_TEST ("Message_Queue_Test");
@@ -45,10 +45,10 @@ main (int, char *[])
if (queue.enqueue (entry) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "QUEUE::enqueue\n"), -1);
}
-
+
ACE_DEBUG ((LM_DEBUG, "\nForward Iterations\n"));
{
- ITERATOR iterator (queue);
+ ITERATOR iterator (queue);
for (ACE_Message_Block *entry = 0;
iterator.next (entry) != 0;
@@ -75,7 +75,7 @@ main (int, char *[])
iterator.advance ())
ACE_DEBUG ((LM_DEBUG, "%s\n", entry->base ()));
}
-
+
ACE_DEBUG ((LM_DEBUG, "\nReverse Iterations\n"));
{
QUEUE::REVERSE_ITERATOR iterator (queue);
@@ -90,7 +90,11 @@ main (int, char *[])
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Message_Queue_Iterator<ACE_NULL_SYNCH>;
template class ACE_Message_Queue_Reverse_Iterator<ACE_NULL_SYNCH>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Message_Queue_Iterator<ACE_NULL_SYNCH>
+#pragma instantiate ACE_Message_Queue_Reverse_Iterator<ACE_NULL_SYNCH>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp
index b1719ddbcbd..4a7e698e6c6 100644
--- a/tests/Process_Strategy_Test.cpp
+++ b/tests/Process_Strategy_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Process_Strategy_Test.cpp
//
@@ -33,7 +33,7 @@
//
// = AUTHOR
// Doug Schmidt and Kevin Boyle <kboyle@sanwafp.com>
-//
+//
// ============================================================================
#include "ace/Acceptor.h"
@@ -66,7 +66,7 @@ public:
protected:
// = Methods invoked via "pointer to method" table entry.
-
+
virtual int svc (void);
// Handle the THREAD case.
@@ -86,7 +86,7 @@ protected:
// Define a <Strategy_Acceptor> that's parameterized by the
// <Counting_Service>.
-typedef ACE_Strategy_Acceptor <Counting_Service, ACE_SOCK_ACCEPTOR>
+typedef ACE_Strategy_Acceptor <Counting_Service, ACE_SOCK_ACCEPTOR>
ACCEPTOR;
class Options : public ACE_Event_Handler
@@ -159,7 +159,7 @@ Options::filename (void)
}
Options::Options (void)
- :
+ :
#if !defined (ACE_LACKS_EXEC)
concurrency_type_ (PROCESS)
#elif defined (ACE_HAS_THREADS)
@@ -196,20 +196,20 @@ Options::parse_args (int argc, char *argv[])
this->filename_ = get_opt.optarg;
break;
default:
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"usage: %n [-f (filename)] [-c (concurrency strategy)]\n%a", 1));
/* NOTREACHED */
}
// Initialize the file lock.
- if (this->file_lock_.open (ACE_WIDE_STRING (this->filename_),
- O_RDWR | O_CREAT,
+ if (this->file_lock_.open (ACE_WIDE_STRING (this->filename_),
+ O_RDWR | O_CREAT,
ACE_DEFAULT_FILE_PERMS) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
// Note that this object lives beyond the lifetime of the Acceptor.
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) opening %s on handle %d.\n",
this->filename_, this->file_lock_.get_handle ()));
@@ -226,8 +226,8 @@ Options::parse_args (int argc, char *argv[])
{
case Options::PROCESS:
#if !defined (ACE_LACKS_EXEC)
- ACE_NEW_RETURN (this->concurrency_strategy_,
- ACE_Process_Strategy<Counting_Service>
+ ACE_NEW_RETURN (this->concurrency_strategy_,
+ ACE_Process_Strategy<Counting_Service>
(1, this, ACE_Reactor::instance()),
-1);
break;
@@ -236,8 +236,8 @@ Options::parse_args (int argc, char *argv[])
#endif /* !defined (ACE_LACKS_EXEC) */
case Options::THREAD:
#if defined (ACE_HAS_THREADS)
- ACE_NEW_RETURN (this->concurrency_strategy_,
- ACE_Thread_Strategy<Counting_Service>
+ ACE_NEW_RETURN (this->concurrency_strategy_,
+ ACE_Thread_Strategy<Counting_Service>
(ACE_Thread_Manager::instance (),
THR_NEW_LWP, 1),
-1);
@@ -247,8 +247,8 @@ Options::parse_args (int argc, char *argv[])
#endif /* !ACE_HAS_THREADS */
case Options::REACTIVE:
// Settle for the purely Reactive strategy.
- ACE_NEW_RETURN (this->concurrency_strategy_,
- ACE_Reactive_Strategy<Counting_Service>
+ ACE_NEW_RETURN (this->concurrency_strategy_,
+ ACE_Reactive_Strategy<Counting_Service>
(ACE_Reactor::instance()),
-1);
break;
@@ -264,13 +264,13 @@ Options::parse_args (int argc, char *argv[])
return 0;
}
-Options::Concurrency_Type
+Options::Concurrency_Type
Options::concurrency_type (void)
{
return this->concurrency_type_;
}
-void
+void
Options::concurrency_type (Options::Concurrency_Type cs)
{
this->concurrency_type_ = cs;
@@ -317,7 +317,7 @@ Counting_Service::read (void)
OPTIONS::instance ()->file_lock ().get_handle ()));
int count;
- if (ACE_OS::pread (OPTIONS::instance ()->file_lock ().get_handle (),
+ if (ACE_OS::pread (OPTIONS::instance ()->file_lock ().get_handle (),
(void *) &count,
sizeof count,
0) != sizeof count)
@@ -343,7 +343,7 @@ Counting_Service::inc (void)
{
ACE_WRITE_GUARD_RETURN (ACE_File_Lock, ace_mon, OPTIONS::instance ()->file_lock (), -1);
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) incrementing on handle %d.\n",
OPTIONS::instance ()->file_lock ().get_handle ()));
@@ -359,7 +359,7 @@ Counting_Service::inc (void)
count, count + 1));
count++;
- if (ACE_OS::pwrite (OPTIONS::instance ()->file_lock ().get_handle (),
+ if (ACE_OS::pwrite (OPTIONS::instance ()->file_lock ().get_handle (),
(const void *) &count,
sizeof count,
0) != sizeof count)
@@ -370,12 +370,12 @@ Counting_Service::inc (void)
// Receive the request from the client and call the appropriate
// operation.
-int
+int
Counting_Service::handle_input (ACE_HANDLE)
{
char buf[BUFSIZ];
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) reading from peer on %d\n",
this->peer ().get_handle ()));
@@ -392,7 +392,7 @@ Counting_Service::handle_input (ACE_HANDLE)
return -1;
else
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) %d bytes of input on %d is %*s\n",
len, this->peer ().get_handle (), bytes, buf));
@@ -423,10 +423,10 @@ Counting_Service::svc (void)
// This method is called back by the <Acceptor> once the client has
// connected and the process is forked or spawned.
-int
+int
Counting_Service::open (void *)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) opening service\n"));
if (OPTIONS::instance ()->concurrency_type () == Options::PROCESS)
@@ -437,7 +437,7 @@ Counting_Service::open (void *)
while (this->handle_input () >= 0)
continue;
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%P|%t) About to exit from the child\n"));
// Exit the child.
@@ -453,7 +453,7 @@ client (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
// Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
+ ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
@@ -493,8 +493,8 @@ client (void *arg)
else if (stream.recv (buf, sizeof buf) <= 0)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "recv"), 0);
- // ACE_DEBUG ((LM_DEBUG,
- // "(%P|%t) client iteration %d, buf = %s\n",
+ // ACE_DEBUG ((LM_DEBUG,
+ // "(%P|%t) client iteration %d, buf = %s\n",
// i, buf));
if (stream.close () == -1)
@@ -540,7 +540,7 @@ server (void *)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
// Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
+ ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
@@ -606,31 +606,31 @@ main (int argc, char *argv[])
/* NOTREACHED */
}
#elif defined (ACE_HAS_THREADS)
- if (ACE_Thread_Manager::instance ()->spawn
- (ACE_THR_FUNC (server),
+ if (ACE_Thread_Manager::instance ()->spawn
+ (ACE_THR_FUNC (server),
(void *) 0,
THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed"));
- if (ACE_Thread_Manager::instance ()->spawn
- (ACE_THR_FUNC (client),
- (void *) &server_addr,
+ if (ACE_Thread_Manager::instance ()->spawn
+ (ACE_THR_FUNC (client),
+ (void *) &server_addr,
THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed"));
// Wait for the threads to exit.
ACE_Thread_Manager::instance ()->wait ();
#else
- ACE_ERROR ((LM_ERROR,
+ ACE_ERROR ((LM_ERROR,
"(%P|%t) only one thread may be run in a process on this platform\n%a", 1));
-#endif /* ACE_HAS_THREADS */
+#endif /* ACE_HAS_THREADS */
}
ACE_END_TEST;
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Accept_Strategy<Counting_Service, ACE_SOCK_ACCEPTOR>;
template class ACE_Acceptor<Counting_Service, ACE_SOCK_ACCEPTOR>;
template class ACE_Creation_Strategy<Counting_Service>;
@@ -645,4 +645,20 @@ template class ACE_Scheduling_Strategy<Counting_Service>;
template class ACE_Strategy_Acceptor<Counting_Service, ACE_SOCK_ACCEPTOR>;
template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
template class ACE_Write_Guard<ACE_File_Lock>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Accept_Strategy<Counting_Service, ACE_SOCK_ACCEPTOR>
+#pragma instantiate ACE_Acceptor<Counting_Service, ACE_SOCK_ACCEPTOR>
+#pragma instantiate ACE_Creation_Strategy<Counting_Service>
+#pragma instantiate ACE_Concurrency_Strategy<Counting_Service>
+#pragma instantiate ACE_Guard<ACE_File_Lock>
+#pragma instantiate ACE_Singleton<Options, ACE_Null_Mutex>
+#pragma instantiate ACE_Process_Strategy<Counting_Service>
+#pragma instantiate ACE_Thread_Strategy<Counting_Service>
+#pragma instantiate ACE_Reactive_Strategy<Counting_Service>
+#pragma instantiate ACE_Read_Guard<ACE_File_Lock>
+#pragma instantiate ACE_Scheduling_Strategy<Counting_Service>
+#pragma instantiate ACE_Strategy_Acceptor<Counting_Service, ACE_SOCK_ACCEPTOR>
+#pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+#pragma instantiate ACE_Write_Guard<ACE_File_Lock>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/Reader_Writer_Test.cpp b/tests/Reader_Writer_Test.cpp
index dab76084aad..3426a26f371 100644
--- a/tests/Reader_Writer_Test.cpp
+++ b/tests/Reader_Writer_Test.cpp
@@ -4,18 +4,18 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Reader_Writer_Test.cpp
//
// = DESCRIPTION
// This test program verifies the functionality of the ACE_OS
// implementation of readers/writer locks on Win32 and Posix
-// pthreads.
+// pthreads.
//
// = AUTHOR
// Prashant Jain and Doug C. Schmidt
-//
+//
// ============================================================================
#include "ace/Synch.h"
@@ -39,20 +39,20 @@ static size_t n_readers = 6;
static size_t n_writers = 4;
// Thread id of last writer.
-static ACE_thread_t shared_data;
+static ACE_thread_t shared_data;
// Lock for shared_data.
-static ACE_RW_Mutex rw_mutex;
+static ACE_RW_Mutex rw_mutex;
// Count of the number of readers and writers.
static ACE_Atomic_Op<ACE_Thread_Mutex, int> current_readers;
static ACE_Atomic_Op<ACE_Thread_Mutex, int> current_writers;
// Explain usage and exit.
-static void
+static void
print_usage_and_die (void)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"usage: %n [-r n_readers] [-w n_writers] [-n iteration_count]\n"));
ACE_OS::exit (1);
}
@@ -62,7 +62,7 @@ parse_args (int argc, char *argv[])
{
ACE_Get_Opt get_opt (argc, argv, "r:w:n:");
- int c;
+ int c;
while ((c = get_opt ()) != -1)
switch (c)
@@ -81,7 +81,7 @@ parse_args (int argc, char *argv[])
break;
}
}
-
+
// Iterate <n_iterations> each time checking that nobody modifies the data
// while we have a read lock.
@@ -92,7 +92,7 @@ reader (void *)
ACE_NEW_THREAD;
ACE_DEBUG ((LM_DEBUG, " (%t) reader starting\n"));
-
+
for (size_t iterations = 1; iterations <= n_iterations; iterations++)
{
ACE_Read_Guard<ACE_RW_Mutex> g (rw_mutex);
@@ -101,7 +101,7 @@ reader (void *)
if (current_writers > 0)
ACE_DEBUG ((LM_DEBUG, " (%t) writers found!!!\n"));
-
+
ACE_thread_t data = shared_data;
for (size_t loop = 1; loop <= n_loops; loop++)
@@ -109,8 +109,8 @@ reader (void *)
ACE_Thread::yield ();
if (!ACE_OS::thr_equal (shared_data, data))
- ACE_DEBUG ((LM_DEBUG,
- " (%t) somebody changed %d to %d\n",
+ ACE_DEBUG ((LM_DEBUG,
+ " (%t) somebody changed %d to %d\n",
data, shared_data));
}
@@ -132,7 +132,7 @@ writer (void *)
ACE_NEW_THREAD;
ACE_DEBUG ((LM_DEBUG, " (%t) writer starting\n"));
-
+
for (size_t iterations = 1; iterations <= n_iterations; iterations++)
{
ACE_Write_Guard<ACE_RW_Mutex> g (rw_mutex);
@@ -145,7 +145,7 @@ writer (void *)
if (current_readers > 0)
ACE_DEBUG ((LM_DEBUG, " (%t) readers found!!!\n"));
-
+
ACE_thread_t self = ACE_Thread::self ();
shared_data = self;
@@ -155,8 +155,8 @@ writer (void *)
ACE_Thread::yield ();
if (!ACE_OS::thr_equal (shared_data, self))
- ACE_DEBUG ((LM_DEBUG,
- " (%t) somebody wrote on my data %d\n",
+ ACE_DEBUG ((LM_DEBUG,
+ " (%t) somebody wrote on my data %d\n",
shared_data));
}
@@ -184,14 +184,14 @@ int main (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG, " (%t) main thread starting\n"));
- if (ACE_Thread_Manager::instance ()->spawn_n (n_readers,
- ACE_THR_FUNC (reader),
- 0,
+ if (ACE_Thread_Manager::instance ()->spawn_n (n_readers,
+ ACE_THR_FUNC (reader),
+ 0,
THR_NEW_LWP) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1);
- else if (ACE_Thread_Manager::instance ()->spawn_n (n_writers,
- ACE_THR_FUNC (writer),
- 0,
+ else if (ACE_Thread_Manager::instance ()->spawn_n (n_writers,
+ ACE_THR_FUNC (writer),
+ 0,
THR_NEW_LWP) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1);
@@ -207,8 +207,13 @@ int main (int argc, char *argv[])
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Read_Guard<ACE_RW_Mutex>;
template class ACE_Write_Guard<ACE_RW_Mutex>;
template class ACE_Guard<ACE_RW_Mutex>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Read_Guard<ACE_RW_Mutex>
+#pragma instantiate ACE_Write_Guard<ACE_RW_Mutex>
+#pragma instantiate ACE_Guard<ACE_RW_Mutex>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/SV_Shared_Memory_Test.cpp b/tests/SV_Shared_Memory_Test.cpp
index 18a95c95ff8..f8df6c99335 100644
--- a/tests/SV_Shared_Memory_Test.cpp
+++ b/tests/SV_Shared_Memory_Test.cpp
@@ -4,17 +4,17 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// SV_Shared_Memory_Test.cpp
//
// = DESCRIPTION
// This is a simple test of ACE_SV_Shared_Memory and ACE_Malloc
-// using the ACE_Shared_Memory_Pool.
+// using the ACE_Shared_Memory_Pool.
//
// = AUTHOR
// Prashant Jain and Doug Schmidt
-//
+//
// ============================================================================
#include "ace/Malloc.h"
@@ -87,12 +87,18 @@ child (char *shm)
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>;
template class ACE_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Write_Guard<ACE_SV_Semaphore_Simple>;
template class ACE_Read_Guard<ACE_SV_Semaphore_Simple>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Guard<ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Write_Guard<ACE_SV_Semaphore_Simple>
+#pragma instantiate ACE_Read_Guard<ACE_SV_Semaphore_Simple>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
#endif /* ACE_HAS_SYSV_IPC */
@@ -118,7 +124,7 @@ main (int, char *[])
break;
}
#else
- ACE_ERROR ((LM_ERROR,
+ ACE_ERROR ((LM_ERROR,
"SYSV IPC is not supported on this platform\n"));
#endif /* ACE_HAS_SYSV_IPC */
ACE_END_TEST;
diff --git a/tests/Service_Config_Test.cpp b/tests/Service_Config_Test.cpp
index 79699e77a3b..04019f529b6 100644
--- a/tests/Service_Config_Test.cpp
+++ b/tests/Service_Config_Test.cpp
@@ -92,8 +92,13 @@ main (int argc, char *argv[])
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class mySingleton<1>;
template class mySingleton<2>;
template class mySingleton<3>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate mySingleton<1>
+#pragma instantiate mySingleton<2>
+#pragma instantiate mySingleton<3>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/Simple_Message_Block_Test.cpp b/tests/Simple_Message_Block_Test.cpp
index 378af323a28..4f2b79accd2 100644
--- a/tests/Simple_Message_Block_Test.cpp
+++ b/tests/Simple_Message_Block_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Simple_Message_Block_Test.cpp
//
@@ -17,18 +17,18 @@
//
// = AUTHOR
// Irfan Pyarali (irfan@cs.wustl.edu)
-//
+//
// ============================================================================
#include "ace/Message_Block.h"
#include "ace/Synch.h"
#include "test_config.h"
-int
+int
main (void)
{
ACE_START_TEST ("Simple_Message_Block_Test");
-
+
{
// Checks normal stack deletes.
ACE_Message_Block mb;
@@ -46,7 +46,7 @@ main (void)
// Checks continuation of message blocks on the stack.
ACE_Message_Block mb1 (1024);
ACE_Message_Block mb2 (1024);
-
+
mb1.cont (&mb2);
}
@@ -54,7 +54,7 @@ main (void)
// Checks continuation of message blocks on the heap.
ACE_Message_Block *mb1;
ACE_Message_Block *mb2;
-
+
ACE_NEW_RETURN (mb1, ACE_Message_Block (1024), -1);
ACE_NEW_RETURN (mb2, ACE_Message_Block (1024), -1);
@@ -66,7 +66,7 @@ main (void)
{
ACE_Lock_Adapter <ACE_SYNCH_MUTEX> mutex;
ACE_Lock *lock = &mutex;
-
+
{
// Checks normal stack deletes.
ACE_Message_Block mb;
@@ -85,7 +85,7 @@ main (void)
// Checks continuation of message blocks on the stack with one
// lock strategy.
ACE_Message_Block mb1 (1024);
- ACE_Message_Block mb2 (1024);
+ ACE_Message_Block mb2 (1024);
mb1.locking_strategy (lock);
@@ -97,7 +97,7 @@ main (void)
// lock strategy.
ACE_Message_Block *mb1;
ACE_Message_Block *mb2;
-
+
ACE_NEW_RETURN (mb1, ACE_Message_Block (1024), -1);
ACE_NEW_RETURN (mb2, ACE_Message_Block (1024), -1);
@@ -111,7 +111,7 @@ main (void)
// Checks continuation of message blocks on the stack with two
// lock strategy.
ACE_Message_Block mb1 (1024);
- ACE_Message_Block mb2 (1024);
+ ACE_Message_Block mb2 (1024);
mb1.locking_strategy (lock);
mb2.locking_strategy (lock);
@@ -124,7 +124,7 @@ main (void)
// lock strategy
ACE_Message_Block *mb1;
ACE_Message_Block *mb2;
-
+
ACE_NEW_RETURN (mb1, ACE_Message_Block (1024), -1);
ACE_NEW_RETURN (mb2, ACE_Message_Block (1024), -1);
@@ -159,7 +159,7 @@ main (void)
ACE_Message_Block *mb1;
ACE_Message_Block *mb2;
-
+
ACE_NEW_RETURN (mb1, ACE_Message_Block (1024), -1);
ACE_NEW_RETURN (mb2, ACE_Message_Block (1024), -1);
@@ -172,8 +172,11 @@ main (void)
ACE_END_TEST;
return 0;
-}
+}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Lock_Adapter<ACE_SYNCH_MUTEX>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Lock_Adapter<ACE_SYNCH_MUTEX>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp
index 8e540ee58ee..9fd64e866ae 100644
--- a/tests/TSS_Test.cpp
+++ b/tests/TSS_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// TSS_Test.cpp
//
@@ -13,11 +13,11 @@
// wrapper transparently ensures that the objects of this class
// will be placed in thread-specific storage. All calls on
// ACE_TSS::operator->() are delegated to the appropriate method
-// in the Errno class.
+// in the Errno class.
//
// = AUTHOR
// Prashant Jain and Doug Schmidt
-//
+//
// ============================================================================
#include "ace/Service_Config.h"
@@ -25,7 +25,7 @@
#include "TSS_Test_Errno.h"
#include "test_config.h"
-#if defined (ACE_HAS_THREADS)
+#if defined (ACE_HAS_THREADS)
static const int ITERATIONS = 100;
@@ -48,7 +48,7 @@ static ACE_Null_Mutex cout_lock;
typedef ACE_Guard<ACE_Null_Mutex> GUARD;
#endif /* ACE_HAS_THREADS */
-extern "C" void
+extern "C" void
cleanup (void *ptr)
{
ACE_DEBUG ((LM_DEBUG, "(%t) in cleanup, ptr = %x\n", ptr));
@@ -146,24 +146,27 @@ worker (void *c)
return 0;
}
-extern "C" void
+extern "C" void
handler (int signum)
{
ACE_DEBUG ((LM_DEBUG, "signal = %S\n", signum));
ACE_Thread_Manager::instance ()->exit (0);
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_TSS<Errno>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_TSS<Errno>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
#endif /* ACE_HAS_THREADS */
-int
+int
main (int, char *[])
{
ACE_START_TEST ("TSS_Test");
-
+
#if defined (ACE_HAS_THREADS)
ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
@@ -171,15 +174,15 @@ main (int, char *[])
ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
ACE_UNUSED_ARG (sa);
- if (ACE_Thread_Manager::instance ()->spawn_n (ACE_MAX_THREADS,
- ACE_THR_FUNC (&worker),
+ if (ACE_Thread_Manager::instance ()->spawn_n (ACE_MAX_THREADS,
+ ACE_THR_FUNC (&worker),
(void *) ITERATIONS,
THR_BOUND | THR_DETACHED) == -1)
ACE_OS::perror ("ACE_Thread_Manager::spawn_n");
ACE_Thread_Manager::instance ()->wait ();
#else
- ACE_ERROR ((LM_ERROR,
+ ACE_ERROR ((LM_ERROR,
"threads are not supported on this platform\n"));
#endif /* ACE_HAS_THREADS */
ACE_END_TEST;
diff --git a/tests/Thread_Pool_Test.cpp b/tests/Thread_Pool_Test.cpp
index 36c81d09d23..eea0bb607ef 100644
--- a/tests/Thread_Pool_Test.cpp
+++ b/tests/Thread_Pool_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Thread_Pool_Test.cpp
//
@@ -19,7 +19,7 @@
//
// = AUTHOR
// Karlheinz Dorn, Doug Schmidt, and Prashant Jain
-//
+//
// ============================================================================
#include "ace/Task.h"
@@ -37,7 +37,7 @@ class Thread_Pool : public ACE_Task<ACE_MT_SYNCH>
public:
Thread_Pool (int n_threads);
// Create the thread pool containing <n_threads>.
-
+
~Thread_Pool (void);
virtual int open (void * = 0);
@@ -64,34 +64,34 @@ Thread_Pool::~Thread_Pool (void)
{
}
-int
-Thread_Pool::close (u_long)
-{
+int
+Thread_Pool::close (u_long)
+{
ACE_DEBUG ((LM_DEBUG, "(%t) close of worker\n"));
return 0;
}
-Thread_Pool::Thread_Pool (int n_threads)
+Thread_Pool::Thread_Pool (int n_threads)
{
// Create a pool of worker threads.
if (this->activate (THR_NEW_LWP, n_threads) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "activate failed"));
}
-
+
// Simply enqueue the Message_Block into the end of the queue.
int
Thread_Pool::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
-{
- return this->putq (mb, tv);
+{
+ return this->putq (mb, tv);
}
// Iterate <n_iterations> printing off a message and "waiting" for all
// other threads to complete this iteration.
-int
-Thread_Pool::svc (void)
-{
+int
+Thread_Pool::svc (void)
+{
ACE_NEW_THREAD;
// The <ACE_Task::svc_run()> method automatically adds us to the
// <ACE_Service_Config>'s <ACE_Thread_Manager> when the thread
@@ -101,7 +101,7 @@ Thread_Pool::svc (void)
// message with a length == 0, which signals us to quit.
for (int count = 1; ; count++)
- {
+ {
ACE_Message_Block *mb;
ACE_ASSERT (this->getq (mb) != -1);
@@ -109,7 +109,7 @@ Thread_Pool::svc (void)
int length = mb->length ();
if (length > 0)
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) in iteration %d, queue len = %d, length = %d, text = \"%*s\"\n",
count, this->msg_queue ()->message_count (),
length, length - 1, mb->rd_ptr ()));
@@ -119,7 +119,7 @@ Thread_Pool::svc (void)
if (length == 0)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) in iteration %d, queue len = %d, got NULL message, exiting\n",
count, this->msg_queue ()->message_count ()));
break;
@@ -134,7 +134,7 @@ Thread_Pool::svc (void)
int
Thread_Pool::open (void *)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"(%t) producer start, dumping the Thread_Pool\n"));
this->dump ();
@@ -143,8 +143,8 @@ Thread_Pool::open (void *)
ACE_Message_Block *mb = 0;
// Allocate a new message.
- ACE_NEW_RETURN (mb,
- ACE_Message_Block (BUFSIZ, ACE_Message_Block::MB_DATA,
+ ACE_NEW_RETURN (mb,
+ ACE_Message_Block (BUFSIZ, ACE_Message_Block::MB_DATA,
0, 0, 0, &this->lock_adapter_),
-1);
@@ -164,22 +164,22 @@ Thread_Pool::open (void *)
}
// Send a shutdown message to the waiting threads and exit.
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"\n(%t) sending shutdown message to %d threads, dump of task:\n",
this->thr_count ()));
this->dump ();
ACE_Message_Block *mb = 0;
- ACE_NEW_RETURN (mb,
- ACE_Message_Block (0, ACE_Message_Block::MB_DATA,
+ ACE_NEW_RETURN (mb,
+ ACE_Message_Block (0, ACE_Message_Block::MB_DATA,
0, 0, 0, &this->lock_adapter_),
-1);
for (int i = this->thr_count (); i > 0; i--)
{
- ACE_DEBUG ((LM_DEBUG,
- "(%t) EOF, enqueueing NULL block for thread = %d\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) EOF, enqueueing NULL block for thread = %d\n",
i));
// Enqueue an empty message to flag each consumer to shutdown.
@@ -199,20 +199,23 @@ Thread_Pool::open (void *)
return 0;
}
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Lock_Adapter<ACE_Thread_Mutex>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Lock_Adapter<ACE_Thread_Mutex>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
#endif /* ACE_HAS_THREADS */
-int
+int
main (int, char *[])
{
ACE_START_TEST ("Thread_Pool_Test");
#if defined (ACE_HAS_THREADS)
int n_threads = ACE_MAX_THREADS;
-
+
ACE_DEBUG ((LM_DEBUG, "(%t) threads = %d\n", n_threads));
// Create the worker tasks.
@@ -229,7 +232,7 @@ main (int, char *[])
ACE_ASSERT (thread_pool.msg_queue ()->is_empty ());
ACE_DEBUG ((LM_DEBUG, "(%t) destroying worker tasks and exiting...\n"));
-
+
#else
ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n"));
#endif /* ACE_HAS_THREADS */