diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-08-23 19:43:35 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-08-23 19:43:35 +0000 |
commit | 84a6c0b74d2ec84ebb8a14a2fb0db74b26c3c27c (patch) | |
tree | c1aead4577a2a8eff7bc9ede65b0c2124c651bc8 /examples/Threads/test_process_semaphore.cpp | |
parent | 943335af387744751031ff5543bc09ea4a9a1554 (diff) | |
download | ATCD-ACE-4_3.tar.gz |
This commit was manufactured by cvs2svn to create branch 'ACE-4_3'.ACE-4_3
Diffstat (limited to 'examples/Threads/test_process_semaphore.cpp')
-rw-r--r-- | examples/Threads/test_process_semaphore.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/examples/Threads/test_process_semaphore.cpp b/examples/Threads/test_process_semaphore.cpp deleted file mode 100644 index d7933897f8e..00000000000 --- a/examples/Threads/test_process_semaphore.cpp +++ /dev/null @@ -1,56 +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" - -static sig_atomic_t done; - -extern "C" void -handler (int) -{ - done = 1; -} - -int -main (int argc, char *argv[]) -{ - char *name = argc == 1 ? "hello" : argv[1]; - - ACE_Process_Semaphore pm (1, name); - - ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); - - for (int i = 0; i < 100 && !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; -} - |