diff options
author | Adam Mitz <mitza@ociweb.com> | 2015-11-06 17:07:11 -0600 |
---|---|---|
committer | Adam Mitz <mitza@ociweb.com> | 2015-11-06 17:07:11 -0600 |
commit | ac5e1702c9f9bee9f1f7bfce8c1a6f3847ea6b4b (patch) | |
tree | 0e70d1f51c39e688a05a6cdc2af58408222e4a0d /ACE/tests/MM_Shared_Memory_Test.cpp | |
parent | 5272b5b81f92c298cb998b5bb0b0dbca3e7f29fe (diff) | |
download | ATCD-ac5e1702c9f9bee9f1f7bfce8c1a6f3847ea6b4b.tar.gz |
Merged branch ace-face-safety (FACE Safety Profile import from OCITAO).
Diffstat (limited to 'ACE/tests/MM_Shared_Memory_Test.cpp')
-rw-r--r-- | ACE/tests/MM_Shared_Memory_Test.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ACE/tests/MM_Shared_Memory_Test.cpp b/ACE/tests/MM_Shared_Memory_Test.cpp index d452be14839..e7e24e06623 100644 --- a/ACE/tests/MM_Shared_Memory_Test.cpp +++ b/ACE/tests/MM_Shared_Memory_Test.cpp @@ -34,6 +34,7 @@ static ACE_TCHAR *shm_key; #if defined (ACE_LACKS_FORK) #include "ace/Thread_Semaphore.h" typedef ACE_Thread_Semaphore SYNCHRONIZER; +#define SYNC_EXTRA_ARGS #elif defined (ACE_HAS_POSIX_SEM) && defined(ACE_HAS_SYSV_IPC) /** * @class SYNCHRONIZER @@ -51,8 +52,19 @@ public: initial_value) {} }; +#define SYNC_EXTRA_ARGS #else + typedef ACE_Process_Semaphore SYNCHRONIZER; + +#define SYNC_EXTRA_ARGS , sem_name () +ACE_TCHAR sem_name_[ACE_UNIQUE_NAME_LEN] = ACE_TEXT ("/"); + +const ACE_TCHAR *sem_name () +{ + ACE::unique_name (sem_name_, sem_name_ + 1, ACE_UNIQUE_NAME_LEN - 1); + return sem_name_; +} #endif /* !defined (ACE_LACKS_FORK) */ // Synchronize the start of the parent and the child. @@ -132,7 +144,7 @@ spawn (void) // to avoid race condition between the creation in the parent and // use in the child. ACE_NEW_RETURN (synchronizer, - SYNCHRONIZER ((unsigned int)0), // Locked by default... + SYNCHRONIZER (0u /*locked*/ SYNC_EXTRA_ARGS), -1); #if !defined (ACE_LACKS_FORK) @@ -145,14 +157,14 @@ spawn (void) 1); /* NOTREACHED */ case 0: - parent (); + child (); // Remove the semaphore. synchronizer->remove (); delete synchronizer; break; /* NOTREACHED */ default: - child (); + parent (); delete synchronizer; break; /* NOTREACHED */ |