diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2006-10-28 00:32:58 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2006-10-28 00:32:58 +0000 |
commit | 6e5adae606e5e2d4b1717074c14623a92ce5df14 (patch) | |
tree | beb19b2b58ca89c22e89cdbbebcd0f74c843b591 /ACE/examples/Threads | |
parent | 8772f91802c646dd6fdd3065156c48a908a274f4 (diff) | |
download | ATCD-6e5adae606e5e2d4b1717074c14623a92ce5df14.tar.gz |
ChangeLogTag:Fri Oct 28 03:23:18 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
Diffstat (limited to 'ACE/examples/Threads')
-rw-r--r-- | ACE/examples/Threads/cancel.cpp | 19 | ||||
-rw-r--r-- | ACE/examples/Threads/thread_manager.cpp | 9 | ||||
-rw-r--r-- | ACE/examples/Threads/thread_specific.cpp | 8 |
3 files changed, 13 insertions, 23 deletions
diff --git a/ACE/examples/Threads/cancel.cpp b/ACE/examples/Threads/cancel.cpp index f10bb822580..bdcef678670 100644 --- a/ACE/examples/Threads/cancel.cpp +++ b/ACE/examples/Threads/cancel.cpp @@ -13,15 +13,9 @@ ACE_RCSID(Threads, cancel, "$Id$") #if defined (ACE_HAS_THREADS) static void * -#if ACE_SIZEOF_VOID_P==8 && ACE_SIZEOF_INT<ACE_SIZEOF_VOID_P -worker (long iterations) +worker (intptr_t iterations) { - for (long i = 0; i < iterations; i++) -#else -worker (int iterations) -{ - for (int i = 0; i < iterations; i++) -#endif + for (intptr_t i = 0; i < iterations; i++) { if ((i % 10) == 0 && (ACE_Thread_Manager::instance ()->testcancel (ACE_Thread::self ()) != 0)) @@ -35,7 +29,7 @@ worker (int iterations) } static const int DEFAULT_THREADS = ACE_DEFAULT_THREADS; -static const int DEFAULT_ITERATIONS = 100000; +static const intptr_t DEFAULT_ITERATIONS = 100000; int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) @@ -45,11 +39,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) daemon.open (argv[0]); int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : DEFAULT_THREADS; -#if ACE_SIZEOF_VOID_P==8 && ACE_SIZEOF_INT<ACE_SIZEOF_VOID_P - long n_iterations = (long)( argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS ); -#else - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; -#endif + intptr_t n_iterations = + argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; ACE_Thread_Manager *thr_mgr = ACE_Thread_Manager::instance (); diff --git a/ACE/examples/Threads/thread_manager.cpp b/ACE/examples/Threads/thread_manager.cpp index e6f12f6c939..b2bee7db4c6 100644 --- a/ACE/examples/Threads/thread_manager.cpp +++ b/ACE/examples/Threads/thread_manager.cpp @@ -22,9 +22,9 @@ handler (int signum) } static void * -worker (int iterations) +worker (intptr_t iterations) { - for (int i = 0; i < iterations; i++) + for (intptr_t i = 0; i < iterations; i++) { if ((i % 1000) == 0) { @@ -47,7 +47,7 @@ worker (int iterations) } static const int DEFAULT_THREADS = ACE_DEFAULT_THREADS; -static const int DEFAULT_ITERATIONS = 100000; +static const intptr_t DEFAULT_ITERATIONS = 100000; int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) @@ -61,7 +61,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_UNUSED_ARG (sa); int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : DEFAULT_THREADS; - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; + intptr_t n_iterations = + argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; ACE_Thread_Manager *thr_mgr = ACE_Thread_Manager::instance (); diff --git a/ACE/examples/Threads/thread_specific.cpp b/ACE/examples/Threads/thread_specific.cpp index 04cb3d94627..3af1501ce4d 100644 --- a/ACE/examples/Threads/thread_specific.cpp +++ b/ACE/examples/Threads/thread_specific.cpp @@ -44,9 +44,7 @@ cleanup (void *ptr) static void * worker (void *c) { - // Cast the arg to a long, first, because a pointer is the same size - // as a long on all current ACE platforms. - int count = (int) (long) c; + intptr_t count = static_cast<intptr_t> (c); ACE_thread_key_t key = ACE_OS::NULL_key; int *ip = 0; @@ -68,7 +66,7 @@ worker (void *c) "(%t) %p\n", "ACE_Thread::setspecific")); - for (int i = 0; i < count; i++) + for (intptr_t i = 0; i < count; i++) { if (ACE_Thread::keycreate (&key, cleanup) == -1) ACE_ERROR ((LM_ERROR, @@ -194,7 +192,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_Service_Config daemon (argv[0]); int threads = argc > 1 ? ACE_OS::atoi (argv[1]) : 4; - int count = argc > 2 ? ACE_OS::atoi (argv[2]) : 10000; + intptr_t count = argc > 2 ? ACE_OS::atoi (argv[2]) : 10000; // Register a signal handler. ACE_Sig_Action sa ((ACE_SignalHandler) (handler), SIGINT); |