diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-27 14:30:22 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-27 14:30:22 +0000 |
commit | 61fc52c25e0e79279fba174115f3564b698abd23 (patch) | |
tree | f2489ef7821dc360b2147bd0d4044daa3aefe367 /tests/Semaphore_Test.cpp | |
parent | ebfd0c662d8f470bf6bc2a3daeb7f44abdd21a2e (diff) | |
download | ATCD-61fc52c25e0e79279fba174115f3564b698abd23.tar.gz |
(test_timeout_count,test_timeout): put these in #ifndef STHREADS &&
#ifndef POSIX_SEM protection to avoid compiler warnings about unused
variable/function.
Diffstat (limited to 'tests/Semaphore_Test.cpp')
-rw-r--r-- | tests/Semaphore_Test.cpp | 84 |
1 files changed, 38 insertions, 46 deletions
diff --git a/tests/Semaphore_Test.cpp b/tests/Semaphore_Test.cpp index 2543e0f7005..15dd8f8f8a8 100644 --- a/tests/Semaphore_Test.cpp +++ b/tests/Semaphore_Test.cpp @@ -51,48 +51,14 @@ static size_t n_workers = 10; // Amount to release the semaphore. static size_t n_release_count = 3; -// Number of times to call test_timeout (). -static size_t test_timeout_count = 3; - // Number of timeouts. static size_t timeouts = 0; -// Explain usage and exit. -static void -print_usage_and_die (void) -{ - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("usage: %n [-s n_release_count] [-w n_workers] [-n iteration_count]\n"))); - ACE_OS::exit (1); -} - -static void -parse_args (int argc, ASYS_TCHAR *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, ASYS_TEXT ("s:w:n:")); - - int c; - - while ((c = get_opt ()) != -1) - switch (c) - { - case 's': - n_release_count = ACE_OS::atoi (get_opt.optarg); - break; - case 'w': - n_workers = ACE_OS::atoi (get_opt.optarg); - break; - case 'n': - n_iterations = ACE_OS::atoi (get_opt.optarg); - break; - default: - print_usage_and_die (); - break; - } -} +#if !defined (ACE_HAS_STHREADS) && !defined (ACE_HAS_POSIX_SEM) +// Number of times to call test_timeout (). +static size_t test_timeout_count = 3; // Tests the amount of time spent in a timed wait. - static int test_timeout (void) { @@ -135,6 +101,41 @@ test_timeout (void) ++wait_secs; return status; } +#endif /* ACE_HAS_STHREADS && ACE_HAS_POSIX_SEM */ + +// Explain usage and exit. +static void +print_usage_and_die (void) +{ + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("usage: %n [-s n_release_count] [-w n_workers] [-n iteration_count]\n"))); + ACE_OS::exit (1); +} + +static void +parse_args (int argc, ASYS_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ASYS_TEXT ("s:w:n:")); + + int c; + + while ((c = get_opt ()) != -1) + switch (c) + { + case 's': + n_release_count = ACE_OS::atoi (get_opt.optarg); + break; + case 'w': + n_workers = ACE_OS::atoi (get_opt.optarg); + break; + case 'n': + n_iterations = ACE_OS::atoi (get_opt.optarg); + break; + default: + print_usage_and_die (); + break; + } +} // Worker tries to acquire the semaphore, hold it for a while, and // then releases it. @@ -225,12 +226,3 @@ int main (int argc, ASYS_TCHAR *argv[]) ACE_END_TEST; return test_result; } - - - - - - - - - |