diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-07-31 16:14:11 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-07-31 16:14:11 +0000 |
commit | 9c2ec3049a5634f1c916d792e81fc80edb669ea8 (patch) | |
tree | 0d634e179761581cadbffe852e7f9a9f049b5c6e /examples/Threads/process_mutex.cpp | |
parent | 6540653cf736840d5aad719c73a8e43a549080be (diff) | |
download | ATCD-9c2ec3049a5634f1c916d792e81fc80edb669ea8.tar.gz |
This commit was manufactured by cvs2svn to create tag 'TAO-1_4_2'.TAO-1_4_2
Diffstat (limited to 'examples/Threads/process_mutex.cpp')
-rw-r--r-- | examples/Threads/process_mutex.cpp | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/examples/Threads/process_mutex.cpp b/examples/Threads/process_mutex.cpp deleted file mode 100644 index bbb03c08d0b..00000000000 --- a/examples/Threads/process_mutex.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// $Id$ - -// This program tests ACE_Process_Mutexes. To run it, open 3 or 4 -// windows and run this program in each window... - -#include "ace/OS_main.h" -#include "ace/OS_NS_unistd.h" -#include "ace/Thread_Mutex.h" -#include "ace/Signal.h" -#include "ace/Log_Msg.h" -#include "ace/Process_Mutex.h" - -ACE_RCSID(Threads, process_mutex, "$Id$") - -#if defined (ACE_HAS_THREADS) - -static sig_atomic_t done; - -extern "C" void -handler (int) -{ - done = 1; -} - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - const ACE_TCHAR *name = argc > 1 ? argv[1] : ACE_TEXT("hello"); - int iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : 100; - - ACE_Process_Mutex pm (name); - - // Register a signal handler. - ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); - ACE_UNUSED_ARG (sa); - - for (int i = 0; i < iterations && !done; i++) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquiring\n")); - if (pm.acquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "acquire failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquired\n")); - - ACE_OS::sleep (3); - - if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); - - if (pm.tryacquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "tryacquire failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = tryacquire\n")); - - if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); - } - - if (argc > 2) - pm.remove (); - return 0; -} -#else -int -ACE_TMAIN (int, ACE_TCHAR *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "ACE doesn't support support threads on this platform (yet)\n"), - -1); -} -#endif /* ACE_HAS_THREADS */ |