summaryrefslogtreecommitdiff
path: root/tests/Process_Mutex_Test.cpp
diff options
context:
space:
mode:
authormbrudka <mbrudka@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-04-13 23:15:47 +0000
committermbrudka <mbrudka@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-04-13 23:15:47 +0000
commit0dd2323aaf7a6a75d716de2361c15dbc4241bb07 (patch)
tree5102273016492d899ef64e12cc20f270588ed46a /tests/Process_Mutex_Test.cpp
parent61b3bf4bc79a583ef23ed3918255f17be30048ad (diff)
downloadATCD-0dd2323aaf7a6a75d716de2361c15dbc4241bb07.tar.gz
Process_Mutex and Process_Mutex_Test now run correctly under QNX and hopefully
under the systems without SV IPC but with PTHREADS. Minor changes platform_qnx_rtp_gcc.GNU - make depened enabled Svc_Conf_l.cpp is only touched Makefile.* are mpc generated. I suppose they shall be removed from cvs.
Diffstat (limited to 'tests/Process_Mutex_Test.cpp')
-rw-r--r--tests/Process_Mutex_Test.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/Process_Mutex_Test.cpp b/tests/Process_Mutex_Test.cpp
index 5ebe723a9e3..8d622111fd6 100644
--- a/tests/Process_Mutex_Test.cpp
+++ b/tests/Process_Mutex_Test.cpp
@@ -85,9 +85,9 @@ acquire_release (void)
// To see if we really are the only holder of the mutex below,
// we'll try to create a file with exclusive access. If the file
// already exists, we're not the only one holding the mutex.
- char mutex_check[MAXNAMLEN];
- ACE_OS::strcpy (mutex_check, mutex_name);
- ACE_OS::strcat (mutex_check, ACE_TEXT ("_checker"));
+ char mutex_check[MAXPATHLEN+1];
+ ACE_OS::strncpy (mutex_check, mutex_name, MAXPATHLEN);
+ ACE_OS::strncat (mutex_check, ACE_TEXT ("_checker"), MAXPATHLEN);
// Grab the lock
ACE_ASSERT (mutex.acquire () == 0);
@@ -151,6 +151,14 @@ run_main (int argc, ACE_TCHAR *argv[])
else
{
ACE_START_TEST (ACE_TEXT ("Process_Mutex_Test"));
+# if !defined( ACE_HAS_SYSV_IPC) || defined( ACE_USES_MUTEX_FOR_PROCESS_MUTEX )
+ // When Process_Mutex is pthreads based, then the owner of mutex destroys it
+ // in destructor. This may disturb the other processes which still uses the
+ // mutex. It is safer then to hold the mutex in main process, and destroy it after
+ // children finish. This is temporary solution, and in future pthread base
+ // Process_Mutex shall control the destruction of mutex better.
+ ACE_Process_Mutex mutex( ACE_TEXT_CHAR_TO_TCHAR( mutex_name ) );
+# endif
ACE_INIT_LOG ("Process_Mutex_Test-children");
ACE_Process_Options options;