diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-21 22:33:52 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-21 22:33:52 +0000 |
commit | 840b638beb2165e5e3a6532fa4971e4f395e9fc4 (patch) | |
tree | ad574393321716f8259514bc2c6687cd1b002df4 /ace | |
parent | 47031f680c5625496a3cb0ca72193eb8629c3b34 (diff) | |
download | ATCD-840b638beb2165e5e3a6532fa4971e4f395e9fc4.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 15 | ||||
-rw-r--r-- | ace/Synch.cpp | 7 |
2 files changed, 17 insertions, 5 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 605d54bc211..b7198558a9e 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -14,6 +14,21 @@ // Size of a VM page. size_t ACE::pagesize_ = 0; +void +ACE::unique_name (const void *object, + LPTSTR name, + size_t length) +{ + // The process ID will provide uniqueness between processes on the + // same machine. The "this" pointer of the <object> will provide + // uniqueness between other "live" objects in the same process. The + // uniqueness of this name is therefore only valid for the life of + // <object>. + TCHAR temp_name[100]; + ACE_OS::sprintf (temp_name, "%d %d", ACE_OS::getpid (), object); + ACE_OS::strncpy (name, temp_name, length); +} + int ACE::terminate_process (pid_t pid) { diff --git a/ace/Synch.cpp b/ace/Synch.cpp index 2df7c3ed2a7..fdf60c6e40a 100644 --- a/ace/Synch.cpp +++ b/ace/Synch.cpp @@ -60,13 +60,10 @@ ACE_Process_Mutex::ACE_Process_Mutex (LPCTSTR name, void *arg) // For all platforms other than Win32, we are going to create a // machine wide unquie name if one is not provided by the user. On // Win32, unnamed synchronization objects are acceptable. - TCHAR ace_name[BUFSIZ]; + TCHAR ace_name[100]; if (name == 0) { - // The process ID will provide uniqueness between processes on - // the same machine. The "this" pointer will provide uniqueness - // between other mutex objects in the same process. - ACE_OS::sprintf (ace_name, "%d %d", ACE_OS::getpid (), this); + ACE::unique_name (this, ace_name, sizeof ace_name); name = ace_name; } #endif |