diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-10 19:59:37 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-10 19:59:37 +0000 |
commit | 3df4acfa816441fc28a95dee6d0191a927145d95 (patch) | |
tree | b5ae7ca44662cfd8e5c95f1826e4406021a606f5 /tests/Recursive_Mutex_Test.cpp | |
parent | 60a5612b83d856fc0adc52b9f39fac9960ec9818 (diff) | |
download | ATCD-pre-subset.tar.gz |
This commit was manufactured by cvs2svn to create tag 'pre-subset'.pre-subset
Diffstat (limited to 'tests/Recursive_Mutex_Test.cpp')
-rw-r--r-- | tests/Recursive_Mutex_Test.cpp | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/tests/Recursive_Mutex_Test.cpp b/tests/Recursive_Mutex_Test.cpp deleted file mode 100644 index 637cffa3e7a..00000000000 --- a/tests/Recursive_Mutex_Test.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// Recursive_Mutex_Test.cpp -// -// = DESCRIPTION -// This test program verifies the functionality of the ACE_OS -// implementation of recursive mutexes on Win32 and Posix -// pthreads. -// -// = AUTHOR -// Prashant Jain <pjain@cs.wustl.edu> and Doug C. Schmidt <schmidt@cs.wustl.edu> -// -// ============================================================================ - -#include "test_config.h" -#include "ace/Get_Opt.h" -#include "ace/Thread_Manager.h" -#include "ace/Synch.h" - -ACE_RCSID(tests, Recursive_Mutex_Test, "$Id$") - -#if defined (ACE_HAS_THREADS) - -// Total number of iterations. -#if defined (CHORUS) - // Chorus can't handle 100 iterations: - // [amThrd.C:154]: Failed to allocate an AmActor - // NOTE: This may be due to small stack size. We should - // try to set ACE_NEEDS_HUGE_THREAD_STACKSIZE instead. - static size_t n_iterations = 45; -#else /* ! CHORUS */ - static size_t n_iterations = 100; -#endif /* ! CHORUS */ -static size_t n_threads = ACE_MAX_THREADS; - -static void -recursive_worker (size_t nesting_level, - ACE_Recursive_Thread_Mutex *rm) -{ - if (nesting_level < n_iterations) - { - ACE_ASSERT (rm->acquire () == 0); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) = acquired, nesting = %d, thread id = %u\n"), - rm->get_nesting_level (), - rm->get_thread_id ())); - - recursive_worker (nesting_level + 1, - rm); - - ACE_ASSERT (rm->release () == 0); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) = released, nesting = %d, thread id = %u\n"), - rm->get_nesting_level (), - rm->get_thread_id ())); - } -} - -static void * -worker (void *arg) -{ - ACE_Recursive_Thread_Mutex *rm = - ACE_reinterpret_cast (ACE_Recursive_Thread_Mutex *, - arg); - recursive_worker (0, rm); - return 0; -} - -#endif /* ACE_HAS_THREADS */ - -int -ACE_TMAIN (int, ACE_TCHAR *[]) -{ - ACE_START_TEST (ACE_TEXT ("Recursive_Mutex_Test")); - -#if defined (ACE_HAS_THREADS) - ACE_Recursive_Thread_Mutex rm; - - ACE_Thread_Manager::instance ()->spawn_n (n_threads, - ACE_THR_FUNC (worker), - (void *) &rm); - ACE_Thread_Manager::instance ()->wait (); -#else - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE doesn't support recursive process mutexes on this platform\n"))); -#endif /* ACE_WIN32 */ - ACE_END_TEST; - return 0; -} |