summaryrefslogtreecommitdiff
path: root/tests/Tokens_Test.cpp
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-05 09:52:56 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-05 09:52:56 +0000
commita88a9ed99c706658a9e6cdb5cdedbb3d977c6a62 (patch)
tree80ad8b136bf72d82f20771a08d5a39f4ffbab77d /tests/Tokens_Test.cpp
parentc4c4914a8a212dffcedccf3ab15ec1118eab5bbb (diff)
downloadATCD-a88a9ed99c706658a9e6cdb5cdedbb3d977c6a62.tar.gz
Pure unicode fixes.
Diffstat (limited to 'tests/Tokens_Test.cpp')
-rw-r--r--tests/Tokens_Test.cpp77
1 files changed, 40 insertions, 37 deletions
diff --git a/tests/Tokens_Test.cpp b/tests/Tokens_Test.cpp
index b4b75cb6c7d..d6678b9a168 100644
--- a/tests/Tokens_Test.cpp
+++ b/tests/Tokens_Test.cpp
@@ -45,7 +45,7 @@ USELIB("..\ace\aced.lib");
typedef ACE_Token_Invariant_Manager TOKEN_INVARIANTS;
-static const char *server_host = ACE_DEFAULT_SERVER_HOST;
+static const ASYS_TCHAR *server_host = ACE_DEFAULT_SERVER_HOST;
static const int server_port = 23456;
// Synchronize starts of threads, so that they all start before one
@@ -59,7 +59,7 @@ struct Test_Params
public:
ACE_Token_Proxy *token1_;
ACE_Token_Proxy *token2_;
- const char *collection_name_;
+ const ASYS_TCHAR *collection_name_;
};
static void *
@@ -70,7 +70,7 @@ run_thread (void *vp)
collection.insert (*(tp->token1_));
collection.insert (*(tp->token2_));
- ACE_DEBUG ((LM_DEBUG, "(%t) new thread.\n"));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) new thread.\n")));
thread_start->wait ();
int count = 50;
@@ -80,17 +80,19 @@ run_thread (void *vp)
{
if (ACE_OS::last_error () == EDEADLK)
{
- ACE_DEBUG ((LM_DEBUG, "deadlock detected in acquire"));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("deadlock detected in acquire")));
continue;
}
- ACE_ERROR ((LM_ERROR, "(%t) %p acquire failed\n","run_thread"));
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("(%t) %p acquire failed\n"),
+ ASYS_TEXT ("run_thread")));
return (void *) -1;
}
ACE_ASSERT ((TOKEN_INVARIANTS::instance ()->acquired (tp->token1_) == 1) ||
(TOKEN_INVARIANTS::instance ()->acquired (tp->token2_) == 1));
- ACE_DEBUG ((LM_DEBUG, "(%t) %s acquired.\n", collection.name ()));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) %s acquired.\n"), collection.name ()));
TOKEN_INVARIANTS::instance ()->releasing (tp->token1_);
TOKEN_INVARIANTS::instance ()->releasing (tp->token2_);
@@ -99,17 +101,18 @@ run_thread (void *vp)
{
if (ACE_OS::last_error () == EDEADLK)
{
- ACE_DEBUG ((LM_DEBUG, "deadlock detected"));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("deadlock detected")));
goto deadlock;
}
- ACE_ERROR ((LM_ERROR, "(%t) %p renew failed\n","run_thread"));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%t) %p renew failed\n"),
+ ASYS_TEXT ("run_thread")));
return (void *) -1;
}
ACE_ASSERT (TOKEN_INVARIANTS::instance ()->acquired (tp->token1_) == 1 ||
TOKEN_INVARIANTS::instance ()->acquired (tp->token2_) == 1);
- ACE_DEBUG ((LM_DEBUG, "(%t) %s renewed.\n", collection.name ()));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) %s renewed.\n"), collection.name ()));
deadlock:
@@ -118,15 +121,15 @@ run_thread (void *vp)
if (collection.release () == -1)
{
- ACE_ERROR ((LM_ERROR, "(%t) %p release failed\n","run_thread"));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%t) %p release failed\n"),ASYS_TEXT ("run_thread")));
return (void *) -1;
}
- ACE_DEBUG ((LM_DEBUG, "(%t) %s released.\n", collection.name ()));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) %s released.\n"), collection.name ()));
}
- ACE_DEBUG ((LM_DEBUG, "(%t) thread finished.\n"));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) thread finished.\n")));
return 0;
}
@@ -142,15 +145,15 @@ run_test (ACE_Token_Proxy *A,
// tp1 and tp2 can run concurrently. Neither tp1 or tp3 can run
// when tp2 is running.
- tp1.collection_name_ = "A and Reader";
+ tp1.collection_name_ = ASYS_TEXT ("A and Reader");
tp1.token1_ = A;
tp1.token2_ = R;
- tp2.collection_name_ = "A and Writer";
+ tp2.collection_name_ = ASYS_TEXT ("A and Writer");
tp2.token1_ = A;
tp2.token2_ = W;
- tp3.collection_name_ = "B and Reader";
+ tp3.collection_name_ = ASYS_TEXT ("B and Reader");
tp3.token1_ = B;
tp3.token2_ = R;
@@ -159,35 +162,35 @@ run_test (ACE_Token_Proxy *A,
if (mgr->spawn (ACE_THR_FUNC (run_thread),
(void *) &tp1, THR_BOUND) == -1)
- ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn 1 failed"), -1);
+ ACE_ERROR_RETURN ((LM_DEBUG, ASYS_TEXT ("%p\n"), ASYS_TEXT ("spawn 1 failed")), -1);
if (mgr->spawn (ACE_THR_FUNC (run_thread),
(void *) &tp2, THR_BOUND) == -1)
- ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn 2 failed"), -1);
+ ACE_ERROR_RETURN ((LM_DEBUG, ASYS_TEXT ("%p\n"), ASYS_TEXT ("spawn 2 failed")), -1);
if (mgr->spawn (ACE_THR_FUNC (run_thread),
(void *) &tp3, THR_BOUND) == -1)
- ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn 3 failed"), -1);
+ ACE_ERROR_RETURN ((LM_DEBUG, ASYS_TEXT ("%p\n"), ASYS_TEXT ("spawn 3 failed")), -1);
// Wait for all threads to exit.
mgr->wait ();
- ACE_DEBUG ((LM_DEBUG, "Test finished.\n"));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("Test finished.\n")));
return 0;
}
#endif /* ACE_HAS_THREADS */
int
-main (int, char *[])
+main (int, ASYS_TCHAR *[])
{
- ACE_START_TEST ("Tokens_Test");
+ ACE_START_TEST (ASYS_TEXT ("Tokens_Test"));
#if defined (ACE_HAS_THREADS)
ACE_Token_Proxy *A = 0, *B = 0, *R = 0, *W = 0;
- ACE_NEW_RETURN (A, ACE_Local_Mutex ("L Mutex A", 0, 0), -1);
- ACE_NEW_RETURN (B, ACE_Local_Mutex ("L Mutex B", 0, 0), -1);
- ACE_NEW_RETURN (R, ACE_Local_RLock ("L Reader Lock", 0, 0), -1);
- ACE_NEW_RETURN (W, ACE_Local_WLock ("L Writer Lock", 0, 0), -1);
+ ACE_NEW_RETURN (A, ACE_Local_Mutex (ASYS_TEXT ("L Mutex A"), 0, 0), -1);
+ ACE_NEW_RETURN (B, ACE_Local_Mutex (ASYS_TEXT ("L Mutex B"), 0, 0), -1);
+ ACE_NEW_RETURN (R, ACE_Local_RLock (ASYS_TEXT ("L Reader Lock"), 0, 0), -1);
+ ACE_NEW_RETURN (W, ACE_Local_WLock (ASYS_TEXT ("L Writer Lock"), 0, 0), -1);
ACE_NEW_RETURN (thread_start, ACE_Barrier (3), -1);
run_test (A, B, R, W);
@@ -203,23 +206,23 @@ main (int, char *[])
ACE_Process_Options options;
options.command_line (cl);
- ACE_DEBUG ((LM_DEBUG, "Forking Token Service.\n"));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("Forking Token Service.\n")));
// Start up the token server for the remote test.
ACE_Process new_process;
if (new_process.spawn (options) == -1)
- ACE_ERROR ((LM_DEBUG, "%n; %p (%s), will not run remote test.\n",
- "Server fork failed", cl));
+ ACE_ERROR ((LM_DEBUG, ASYS_TEXT ("%n; %p (%s), will not run remote test.\n"),
+ ASYS_TEXT ("Server fork failed"), cl));
else
{
- ACE_DEBUG ((LM_DEBUG, "Server forked with pid = %d.\n",
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("Server forked with pid = %d.\n"),
new_process.getpid ()));
// Wait for the server to start.
ACE_OS::sleep (3);
ACE_DEBUG ((LM_DEBUG,
- "Using Token Server on %s at port %d.\n",
+ ASYS_TEXT ("Using Token Server on %s at port %d.\n"),
server_host, server_port));
ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port,
server_host));
@@ -229,10 +232,10 @@ main (int, char *[])
delete R;
delete W;
- ACE_NEW_RETURN (A, ACE_Remote_Mutex ("R Mutex A", 0, 1), -1);
- ACE_NEW_RETURN (B, ACE_Remote_Mutex ("R Mutex B", 0, 1), -1);
- ACE_NEW_RETURN (R, ACE_Remote_RLock ("R Reader Lock", 0, 1), -1);
- ACE_NEW_RETURN (W, ACE_Remote_WLock ("R Writer Lock", 0, 1), -1);
+ ACE_NEW_RETURN (A, ACE_Remote_Mutex (ASYS_TEXT ("R Mutex A"), 0, 1), -1);
+ ACE_NEW_RETURN (B, ACE_Remote_Mutex (ASYS_TEXT ("R Mutex B"), 0, 1), -1);
+ ACE_NEW_RETURN (R, ACE_Remote_RLock (ASYS_TEXT ("R Reader Lock"), 0, 1), -1);
+ ACE_NEW_RETURN (W, ACE_Remote_WLock (ASYS_TEXT ("R Writer Lock"), 0, 1), -1);
run_test (A, B, R, W);
@@ -241,7 +244,7 @@ main (int, char *[])
// Kill the token server.
if (new_process.terminate () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "Kill failed.\n"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("Kill failed.\n")), -1);
}
delete thread_start;
@@ -251,10 +254,10 @@ main (int, char *[])
delete R;
delete W;
- ACE_DEBUG ((LM_DEBUG, "(%t) main thread exiting.\n"));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%t) main thread exiting.\n")));
#else
ACE_ERROR ((LM_INFO,
- "threads not supported on this platform\n"));
+ ASYS_TEXT ("threads not supported on this platform\n")));
#endif /* ACE_HAS_THREADS */
ACE_END_TEST;
return 0;