summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-26 17:47:48 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-26 17:47:48 +0000
commit65f55495cb618964fca15b29e1fee15075f38ca9 (patch)
treea6227f8daa8a33d52f04f4fae0c5e48256fa89ff
parent6b6b475855c3f8933bb95442263c739b1567335d (diff)
downloadATCD-65f55495cb618964fca15b29e1fee15075f38ca9.tar.gz
Fixed so most of the test runs on STHREADS and POSIXSEM platforms.
-rw-r--r--tests/Semaphore_Test.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/tests/Semaphore_Test.cpp b/tests/Semaphore_Test.cpp
index b69af06e606..2543e0f7005 100644
--- a/tests/Semaphore_Test.cpp
+++ b/tests/Semaphore_Test.cpp
@@ -42,7 +42,6 @@ static int test_result = 0;
// count is 0).
static ACE_Thread_Semaphore s (0);
-#if !defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_POSIX_SEM)
// Default number of iterations.
static size_t n_iterations = 10;
@@ -51,27 +50,19 @@ static size_t n_workers = 10;
// Amount to release the semaphore.
static size_t n_release_count = 3;
-#endif /* ! ACE_HAS_STHREADS && ! ACE_HAS_POSIX_SEM */
-#if !defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_POSIX_SEM)
// Number of times to call test_timeout ().
static size_t test_timeout_count = 3;
// Number of timeouts.
static size_t timeouts = 0;
-#endif /* ! ACE_HAS_STHREADS && ! ACE_HAS_POSIX_SEM */
// Explain usage and exit.
static void
print_usage_and_die (void)
{
-#if !defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_POSIX_SEM)
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("usage: %n [-s n_release_count] [-w n_workers] [-n iteration_count]\n")));
-#else /* ACE_HAS_STHREADS || ACE_HAS_POSIX_SEM */
- ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("usage: %n\n")));
-#endif /* ACE_HAS_STHREADS || ACE_HAS_POSIX_SEM */
ACE_OS::exit (1);
}
@@ -85,7 +76,6 @@ parse_args (int argc, ASYS_TCHAR *argv[])
while ((c = get_opt ()) != -1)
switch (c)
{
-#if !defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_POSIX_SEM)
case 's':
n_release_count = ACE_OS::atoi (get_opt.optarg);
break;
@@ -95,14 +85,12 @@ parse_args (int argc, ASYS_TCHAR *argv[])
case 'n':
n_iterations = ACE_OS::atoi (get_opt.optarg);
break;
-#endif /* ! ACE_HAS_STHREADS && ! ACE_HAS_POSIX_SEM */
default:
print_usage_and_die ();
break;
}
}
-#if !defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_POSIX_SEM)
// Tests the amount of time spent in a timed wait.
static int
@@ -190,7 +178,6 @@ worker (void *)
return 0;
}
-#endif /* !ACE_HAS_STHREADS && !ACE_HAS_POSIX_SEM */
#endif /* ACE_HAS_THREADS */
// Test semaphore functionality.
@@ -204,10 +191,11 @@ int main (int argc, ASYS_TCHAR *argv[])
ACE_OS::srand (ACE_OS::time (0L));
#if !defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_POSIX_SEM)
- // Test timed waits.
+ //Test timed waits.
for (size_t i = 0; i < test_timeout_count; i++)
if (test_timeout () != 0)
test_result = 1;
+#endif /* ACE_HAS_STHREADS && ACE_HAS_POSIX_SEM */
// Release the semaphore a certain number of times.
s.release (n_release_count);
@@ -230,10 +218,6 @@ int main (int argc, ASYS_TCHAR *argv[])
ASYS_TEXT ("Worker threads timed out %d percent of the time\n"),
percent));
#else
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("Timed semaphores are not supported with native Solaris threads or on POSIX semaphores\n")));
-#endif /* ACE_HAS_STHREADS && ACE_HAS_POSIX_SEM */
-#else
ACE_UNUSED_ARG (argc);
ACE_UNUSED_ARG (argv);
ACE_ERROR ((LM_ERROR, ASYS_TEXT ("Threads not supported on this platform\n")));
@@ -242,3 +226,11 @@ int main (int argc, ASYS_TCHAR *argv[])
return test_result;
}
+
+
+
+
+
+
+
+