diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-22 16:25:30 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-22 16:25:30 +0000 |
commit | 45240c3596a3bcfaa49485c013a6a930b5a8e9ee (patch) | |
tree | e1c1bd7a49e7d3ef8cf0c7c4964cce11181a3681 /examples/Threads/process_semaphore.cpp | |
parent | 0e051eaa84c80a539704b595dfa4063d87997998 (diff) | |
download | ATCD-TAO-1_1_3.tar.gz |
This commit was manufactured by cvs2svn to create tag 'TAO-1_1_3'.TAO-1_1_3
Diffstat (limited to 'examples/Threads/process_semaphore.cpp')
-rw-r--r-- | examples/Threads/process_semaphore.cpp | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/examples/Threads/process_semaphore.cpp b/examples/Threads/process_semaphore.cpp deleted file mode 100644 index be84ca89fcd..00000000000 --- a/examples/Threads/process_semaphore.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// $Id$ - -// This program tests ACE_Process_Semaphore. To run it, open 3 or 4 -// windows and run this program in each window... - -#include "ace/Synch.h" -#include "ace/Signal.h" - -ACE_RCSID(Threads, process_semaphore, "$Id$") - -static sig_atomic_t done; - -extern "C" void -handler (int) -{ - done = 1; -} - -int -main (int argc, char *argv[]) -{ - const char *name = argc == 1 ? "hello" : argv[1]; - int iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : 100; - - ACE_Process_Semaphore pm (1, name); - - 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; -} - |