Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / Semaphores / worker.cpp
blobdce3f2d79c786312bbd6897622d0da9aa6a5cca0
1 #include "ace/Process_Semaphore.h"
2 #include "ace/OS_NS_unistd.h"
3 #include "ace/Log_Msg.h"
5 int ACE_TMAIN (int, ACE_TCHAR *[])
7 // Create locked
8 ACE_Process_Semaphore s (0, ACE_TEXT ("AceTest"));
10 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Worker is going to acquire semaphore\n")));
12 s.acquire ();
14 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Worker has acquired semaphore\n")));
16 // Do some init stuff. Simulated by a sleep...
17 ACE_OS::sleep(10);
19 s.release();
21 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Worker released semaphore\n")));
23 // Do the work...
24 ACE_OS::sleep(5);
26 return 0;