diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-09-20 19:04:19 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-09-20 19:04:19 +0000 |
commit | 2060687536c91f24e7bb65fa5b736d6ee4c99ec3 (patch) | |
tree | f6362ad44f43a5709aa6dfe1706fbd5e2e47564d | |
parent | 2e69153ee4578068fa6d52001411a87d52274fc5 (diff) | |
download | ATCD-2060687536c91f24e7bb65fa5b736d6ee4c99ec3.tar.gz |
ChangeLogTag:Wed Sep 20 12:00:42 2000 Carlos O'Ryan <coryan@uci.edu>
41 files changed, 1504 insertions, 1053 deletions
diff --git a/ChangeLog b/ChangeLog index d901b15f1eb..92be6cc5413 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,50 @@ +Wed Sep 20 12:00:42 2000 Carlos O'Ryan <coryan@uci.edu> + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace-dll.icc: + * ace/ace-lib.icc: + * ace/File_Lock.h: + * ace/File_Lock.inl: + * ace/File_Lock.cpp: + * ace/Process_Mutex.h: + * ace/Process_Mutex.inl: + * ace/Process_Mutex.cpp: + * ace/Process_Semaphore.h: + * ace/Process_Semaphore.inl: + * ace/Process_Semaphore.cpp: + * ace/RW_Process_Mutex.h: + * ace/RW_Process_Mutex.inl: + * ace/RW_Process_Mutex.cpp: + * ace/Dynamic.cpp: + * ace/Local_Name_Space.cpp: + * ace/Local_Name_Space_T.cpp: + * ace/MEM_SAP.h: + * ace/Naming_Context.cpp: + * ace/Synch.h: + * ace/Synch.i: + * ace/Synch.cpp: + * ace/Synch_T.h: + * ace/Thread_Exit.cpp: + * ace/Thread_Manager.cpp: + * examples/Shared_Malloc/Malloc.cpp: + * examples/Shared_Malloc/test_multiple_mallocs.cpp: + * examples/Shared_Malloc/test_position_independent_malloc.cpp: + * examples/Threads/process_mutex.cpp: + * examples/Threads/process_semaphore.cpp: + * tests/Conn_Test.cpp: + * tests/MM_Shared_Memory_Test.cpp: + * tests/Malloc_Test.cpp: + * tests/Process_Mutex_Test.cpp: + * tests/Process_Strategy_Test.cpp: + Moved the implementation of ACE_File_Lock, ACE_Process_Mutex, + ACE_Process_Semaphore and ACE_RW_Process_Mutex to their own + files. + This removes some unwanted dependencies in the Synch file. + The ACE_ONLY_GREATEST_AND_LATEST macro was used to preserve + backwards compatibility. + Wed Sep 20 14:51:27 2000 Steve Huston <shuston@riverace.com> * ace/Basic_Types.h: Added #include <sys/types.h> after the other @@ -6,9 +53,9 @@ Wed Sep 20 14:51:27 2000 Steve Huston <shuston@riverace.com> Wed Sep 20 11:44:46 2000 Carlos O'Ryan <coryan@uci.edu> - * tests/run_test.pl: - * tests/run_test.lst: - Disable the ACE_Init_Test under UNIX, the test only works on NT. + * tests/run_test.pl: + * tests/run_test.lst: + Disable the ACE_Init_Test under UNIX, the test only works on NT. Wed Sep 20 12:55:16 2000 Steve Huston <shuston@riverace.com> @@ -22,74 +69,74 @@ Wed Sep 20 12:55:16 2000 Steve Huston <shuston@riverace.com> Wed Sep 20 08:24:34 2000 Ossama Othman <ossama@uci.edu> - * ace/Makefile.am (INLINE_FILES): + * ace/Makefile.am (INLINE_FILES): - Corrected `CDR_Base.i' to `CDR_Base.inl'. + Corrected `CDR_Base.i' to `CDR_Base.inl'. Wed Sep 20 08:12:20 2000 Ossama Othman <ossama@uci.edu> - * tests/CDR_Test.cpp: + * tests/CDR_Test.cpp: - Included missing `ace/SString.h' header. + Included missing `ace/SString.h' header. Tue Sep 19 17:12:29 2000 Ossama Othman <ossama@uci.edu> - * ace/Basic_Types.h: + * ace/Basic_Types.h: - Added missing include of `ace/config-all.h' and - `ace/ACE_export.h'. + Added missing include of `ace/config-all.h' and + `ace/ACE_export.h'. - Explicitly include `limits.h', `float.h' and `stdlib.h' to pull - in basic type limits (e.g. UINT_MAX) and typedefs - (e.g. ptr_arith_t). This allows `ace/Basic_Types.h' to be - included as a stand-alone header. Previously, `ace/OS.h' - must have been included at least indirectly before - `ace/Basic_Types.h'. + Explicitly include `limits.h', `float.h' and `stdlib.h' to pull + in basic type limits (e.g. UINT_MAX) and typedefs + (e.g. ptr_arith_t). This allows `ace/Basic_Types.h' to be + included as a stand-alone header. Previously, `ace/OS.h' + must have been included at least indirectly before + `ace/Basic_Types.h'. - * ace/CDR_Base.h: - * ace/CDR_Base.i: - * ace/CDR_Base.cpp: + * ace/CDR_Base.h: + * ace/CDR_Base.i: + * ace/CDR_Base.cpp: - Moved base ACE_CDR class to separate set of files. This reduces - inter-header dependencies for sources that only require the CDR - types. + Moved base ACE_CDR class to separate set of files. This reduces + inter-header dependencies for sources that only require the CDR + types. - * ace/CDR_Stream.h: + * ace/CDR_Stream.h: - Forward declared ACE_CString, and moved inclusion of - `ace/SString.h' to the `.cpp' file to reduce inter-header - dependencies. + Forward declared ACE_CString, and moved inclusion of + `ace/SString.h' to the `.cpp' file to reduce inter-header + dependencies. - * ace/CDR_Stream.i: - * ace/CDR_Stream.cpp: + * ace/CDR_Stream.i: + * ace/CDR_Stream.cpp: - Moved ACE_CString related methods to the `.cpp' file since the - ACE_CString method is now forward declared in the - `ace/CDR_Stream.h' header. + Moved ACE_CString related methods to the `.cpp' file since the + ACE_CString method is now forward declared in the + `ace/CDR_Stream.h' header. Tue Sep 19 17:40:04 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/config-win32-common.h, - ace/config-sunos5.4-centerline-2.x.h: Removed the nonsensical - ACE_HAS_SVR5_GETTIMEOFDAY macro. Thanks to Jeff Grief for - reporting this. + * ace/config-win32-common.h, + ace/config-sunos5.4-centerline-2.x.h: Removed the nonsensical + ACE_HAS_SVR5_GETTIMEOFDAY macro. Thanks to Jeff Grief for + reporting this. Mon Sep 18 12:39:39 2000 Ossama Othman <ossama@uci.edu> - * ace/OS.i (cuserid): + * ace/OS.i (cuserid): - When using ACE's alternate cuserid() implementation: - - ensure that the maximum length argument is non-zero - since it doesn't make sense to have a zero length user ID. - - Return a static buffer if the buffer argument is zero. This - is not reentrant but nothing else can be done in such a case. - [Bug 619] + When using ACE's alternate cuserid() implementation: + - ensure that the maximum length argument is non-zero + since it doesn't make sense to have a zero length user ID. + - Return a static buffer if the buffer argument is zero. This + is not reentrant but nothing else can be done in such a case. + [Bug 619] Mon Sep 18 11:22:02 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/SUN_Proactor.cpp (handle_events): Fixed a problem arising - on 64 bit Solaris platforms. Thanks to Ganesh Pai - <gpai@voicetek.com> for reporting this. + * ace/SUN_Proactor.cpp (handle_events): Fixed a problem arising + on 64 bit Solaris platforms. Thanks to Ganesh Pai + <gpai@voicetek.com> for reporting this. Sun Sep 17 19:17:53 2000 Carlos O'Ryan <coryan@uci.edu> diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index d901b15f1eb..92be6cc5413 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,50 @@ +Wed Sep 20 12:00:42 2000 Carlos O'Ryan <coryan@uci.edu> + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace-dll.icc: + * ace/ace-lib.icc: + * ace/File_Lock.h: + * ace/File_Lock.inl: + * ace/File_Lock.cpp: + * ace/Process_Mutex.h: + * ace/Process_Mutex.inl: + * ace/Process_Mutex.cpp: + * ace/Process_Semaphore.h: + * ace/Process_Semaphore.inl: + * ace/Process_Semaphore.cpp: + * ace/RW_Process_Mutex.h: + * ace/RW_Process_Mutex.inl: + * ace/RW_Process_Mutex.cpp: + * ace/Dynamic.cpp: + * ace/Local_Name_Space.cpp: + * ace/Local_Name_Space_T.cpp: + * ace/MEM_SAP.h: + * ace/Naming_Context.cpp: + * ace/Synch.h: + * ace/Synch.i: + * ace/Synch.cpp: + * ace/Synch_T.h: + * ace/Thread_Exit.cpp: + * ace/Thread_Manager.cpp: + * examples/Shared_Malloc/Malloc.cpp: + * examples/Shared_Malloc/test_multiple_mallocs.cpp: + * examples/Shared_Malloc/test_position_independent_malloc.cpp: + * examples/Threads/process_mutex.cpp: + * examples/Threads/process_semaphore.cpp: + * tests/Conn_Test.cpp: + * tests/MM_Shared_Memory_Test.cpp: + * tests/Malloc_Test.cpp: + * tests/Process_Mutex_Test.cpp: + * tests/Process_Strategy_Test.cpp: + Moved the implementation of ACE_File_Lock, ACE_Process_Mutex, + ACE_Process_Semaphore and ACE_RW_Process_Mutex to their own + files. + This removes some unwanted dependencies in the Synch file. + The ACE_ONLY_GREATEST_AND_LATEST macro was used to preserve + backwards compatibility. + Wed Sep 20 14:51:27 2000 Steve Huston <shuston@riverace.com> * ace/Basic_Types.h: Added #include <sys/types.h> after the other @@ -6,9 +53,9 @@ Wed Sep 20 14:51:27 2000 Steve Huston <shuston@riverace.com> Wed Sep 20 11:44:46 2000 Carlos O'Ryan <coryan@uci.edu> - * tests/run_test.pl: - * tests/run_test.lst: - Disable the ACE_Init_Test under UNIX, the test only works on NT. + * tests/run_test.pl: + * tests/run_test.lst: + Disable the ACE_Init_Test under UNIX, the test only works on NT. Wed Sep 20 12:55:16 2000 Steve Huston <shuston@riverace.com> @@ -22,74 +69,74 @@ Wed Sep 20 12:55:16 2000 Steve Huston <shuston@riverace.com> Wed Sep 20 08:24:34 2000 Ossama Othman <ossama@uci.edu> - * ace/Makefile.am (INLINE_FILES): + * ace/Makefile.am (INLINE_FILES): - Corrected `CDR_Base.i' to `CDR_Base.inl'. + Corrected `CDR_Base.i' to `CDR_Base.inl'. Wed Sep 20 08:12:20 2000 Ossama Othman <ossama@uci.edu> - * tests/CDR_Test.cpp: + * tests/CDR_Test.cpp: - Included missing `ace/SString.h' header. + Included missing `ace/SString.h' header. Tue Sep 19 17:12:29 2000 Ossama Othman <ossama@uci.edu> - * ace/Basic_Types.h: + * ace/Basic_Types.h: - Added missing include of `ace/config-all.h' and - `ace/ACE_export.h'. + Added missing include of `ace/config-all.h' and + `ace/ACE_export.h'. - Explicitly include `limits.h', `float.h' and `stdlib.h' to pull - in basic type limits (e.g. UINT_MAX) and typedefs - (e.g. ptr_arith_t). This allows `ace/Basic_Types.h' to be - included as a stand-alone header. Previously, `ace/OS.h' - must have been included at least indirectly before - `ace/Basic_Types.h'. + Explicitly include `limits.h', `float.h' and `stdlib.h' to pull + in basic type limits (e.g. UINT_MAX) and typedefs + (e.g. ptr_arith_t). This allows `ace/Basic_Types.h' to be + included as a stand-alone header. Previously, `ace/OS.h' + must have been included at least indirectly before + `ace/Basic_Types.h'. - * ace/CDR_Base.h: - * ace/CDR_Base.i: - * ace/CDR_Base.cpp: + * ace/CDR_Base.h: + * ace/CDR_Base.i: + * ace/CDR_Base.cpp: - Moved base ACE_CDR class to separate set of files. This reduces - inter-header dependencies for sources that only require the CDR - types. + Moved base ACE_CDR class to separate set of files. This reduces + inter-header dependencies for sources that only require the CDR + types. - * ace/CDR_Stream.h: + * ace/CDR_Stream.h: - Forward declared ACE_CString, and moved inclusion of - `ace/SString.h' to the `.cpp' file to reduce inter-header - dependencies. + Forward declared ACE_CString, and moved inclusion of + `ace/SString.h' to the `.cpp' file to reduce inter-header + dependencies. - * ace/CDR_Stream.i: - * ace/CDR_Stream.cpp: + * ace/CDR_Stream.i: + * ace/CDR_Stream.cpp: - Moved ACE_CString related methods to the `.cpp' file since the - ACE_CString method is now forward declared in the - `ace/CDR_Stream.h' header. + Moved ACE_CString related methods to the `.cpp' file since the + ACE_CString method is now forward declared in the + `ace/CDR_Stream.h' header. Tue Sep 19 17:40:04 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/config-win32-common.h, - ace/config-sunos5.4-centerline-2.x.h: Removed the nonsensical - ACE_HAS_SVR5_GETTIMEOFDAY macro. Thanks to Jeff Grief for - reporting this. + * ace/config-win32-common.h, + ace/config-sunos5.4-centerline-2.x.h: Removed the nonsensical + ACE_HAS_SVR5_GETTIMEOFDAY macro. Thanks to Jeff Grief for + reporting this. Mon Sep 18 12:39:39 2000 Ossama Othman <ossama@uci.edu> - * ace/OS.i (cuserid): + * ace/OS.i (cuserid): - When using ACE's alternate cuserid() implementation: - - ensure that the maximum length argument is non-zero - since it doesn't make sense to have a zero length user ID. - - Return a static buffer if the buffer argument is zero. This - is not reentrant but nothing else can be done in such a case. - [Bug 619] + When using ACE's alternate cuserid() implementation: + - ensure that the maximum length argument is non-zero + since it doesn't make sense to have a zero length user ID. + - Return a static buffer if the buffer argument is zero. This + is not reentrant but nothing else can be done in such a case. + [Bug 619] Mon Sep 18 11:22:02 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/SUN_Proactor.cpp (handle_events): Fixed a problem arising - on 64 bit Solaris platforms. Thanks to Ganesh Pai - <gpai@voicetek.com> for reporting this. + * ace/SUN_Proactor.cpp (handle_events): Fixed a problem arising + on 64 bit Solaris platforms. Thanks to Ganesh Pai + <gpai@voicetek.com> for reporting this. Sun Sep 17 19:17:53 2000 Carlos O'Ryan <coryan@uci.edu> diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index d901b15f1eb..92be6cc5413 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,50 @@ +Wed Sep 20 12:00:42 2000 Carlos O'Ryan <coryan@uci.edu> + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace-dll.icc: + * ace/ace-lib.icc: + * ace/File_Lock.h: + * ace/File_Lock.inl: + * ace/File_Lock.cpp: + * ace/Process_Mutex.h: + * ace/Process_Mutex.inl: + * ace/Process_Mutex.cpp: + * ace/Process_Semaphore.h: + * ace/Process_Semaphore.inl: + * ace/Process_Semaphore.cpp: + * ace/RW_Process_Mutex.h: + * ace/RW_Process_Mutex.inl: + * ace/RW_Process_Mutex.cpp: + * ace/Dynamic.cpp: + * ace/Local_Name_Space.cpp: + * ace/Local_Name_Space_T.cpp: + * ace/MEM_SAP.h: + * ace/Naming_Context.cpp: + * ace/Synch.h: + * ace/Synch.i: + * ace/Synch.cpp: + * ace/Synch_T.h: + * ace/Thread_Exit.cpp: + * ace/Thread_Manager.cpp: + * examples/Shared_Malloc/Malloc.cpp: + * examples/Shared_Malloc/test_multiple_mallocs.cpp: + * examples/Shared_Malloc/test_position_independent_malloc.cpp: + * examples/Threads/process_mutex.cpp: + * examples/Threads/process_semaphore.cpp: + * tests/Conn_Test.cpp: + * tests/MM_Shared_Memory_Test.cpp: + * tests/Malloc_Test.cpp: + * tests/Process_Mutex_Test.cpp: + * tests/Process_Strategy_Test.cpp: + Moved the implementation of ACE_File_Lock, ACE_Process_Mutex, + ACE_Process_Semaphore and ACE_RW_Process_Mutex to their own + files. + This removes some unwanted dependencies in the Synch file. + The ACE_ONLY_GREATEST_AND_LATEST macro was used to preserve + backwards compatibility. + Wed Sep 20 14:51:27 2000 Steve Huston <shuston@riverace.com> * ace/Basic_Types.h: Added #include <sys/types.h> after the other @@ -6,9 +53,9 @@ Wed Sep 20 14:51:27 2000 Steve Huston <shuston@riverace.com> Wed Sep 20 11:44:46 2000 Carlos O'Ryan <coryan@uci.edu> - * tests/run_test.pl: - * tests/run_test.lst: - Disable the ACE_Init_Test under UNIX, the test only works on NT. + * tests/run_test.pl: + * tests/run_test.lst: + Disable the ACE_Init_Test under UNIX, the test only works on NT. Wed Sep 20 12:55:16 2000 Steve Huston <shuston@riverace.com> @@ -22,74 +69,74 @@ Wed Sep 20 12:55:16 2000 Steve Huston <shuston@riverace.com> Wed Sep 20 08:24:34 2000 Ossama Othman <ossama@uci.edu> - * ace/Makefile.am (INLINE_FILES): + * ace/Makefile.am (INLINE_FILES): - Corrected `CDR_Base.i' to `CDR_Base.inl'. + Corrected `CDR_Base.i' to `CDR_Base.inl'. Wed Sep 20 08:12:20 2000 Ossama Othman <ossama@uci.edu> - * tests/CDR_Test.cpp: + * tests/CDR_Test.cpp: - Included missing `ace/SString.h' header. + Included missing `ace/SString.h' header. Tue Sep 19 17:12:29 2000 Ossama Othman <ossama@uci.edu> - * ace/Basic_Types.h: + * ace/Basic_Types.h: - Added missing include of `ace/config-all.h' and - `ace/ACE_export.h'. + Added missing include of `ace/config-all.h' and + `ace/ACE_export.h'. - Explicitly include `limits.h', `float.h' and `stdlib.h' to pull - in basic type limits (e.g. UINT_MAX) and typedefs - (e.g. ptr_arith_t). This allows `ace/Basic_Types.h' to be - included as a stand-alone header. Previously, `ace/OS.h' - must have been included at least indirectly before - `ace/Basic_Types.h'. + Explicitly include `limits.h', `float.h' and `stdlib.h' to pull + in basic type limits (e.g. UINT_MAX) and typedefs + (e.g. ptr_arith_t). This allows `ace/Basic_Types.h' to be + included as a stand-alone header. Previously, `ace/OS.h' + must have been included at least indirectly before + `ace/Basic_Types.h'. - * ace/CDR_Base.h: - * ace/CDR_Base.i: - * ace/CDR_Base.cpp: + * ace/CDR_Base.h: + * ace/CDR_Base.i: + * ace/CDR_Base.cpp: - Moved base ACE_CDR class to separate set of files. This reduces - inter-header dependencies for sources that only require the CDR - types. + Moved base ACE_CDR class to separate set of files. This reduces + inter-header dependencies for sources that only require the CDR + types. - * ace/CDR_Stream.h: + * ace/CDR_Stream.h: - Forward declared ACE_CString, and moved inclusion of - `ace/SString.h' to the `.cpp' file to reduce inter-header - dependencies. + Forward declared ACE_CString, and moved inclusion of + `ace/SString.h' to the `.cpp' file to reduce inter-header + dependencies. - * ace/CDR_Stream.i: - * ace/CDR_Stream.cpp: + * ace/CDR_Stream.i: + * ace/CDR_Stream.cpp: - Moved ACE_CString related methods to the `.cpp' file since the - ACE_CString method is now forward declared in the - `ace/CDR_Stream.h' header. + Moved ACE_CString related methods to the `.cpp' file since the + ACE_CString method is now forward declared in the + `ace/CDR_Stream.h' header. Tue Sep 19 17:40:04 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/config-win32-common.h, - ace/config-sunos5.4-centerline-2.x.h: Removed the nonsensical - ACE_HAS_SVR5_GETTIMEOFDAY macro. Thanks to Jeff Grief for - reporting this. + * ace/config-win32-common.h, + ace/config-sunos5.4-centerline-2.x.h: Removed the nonsensical + ACE_HAS_SVR5_GETTIMEOFDAY macro. Thanks to Jeff Grief for + reporting this. Mon Sep 18 12:39:39 2000 Ossama Othman <ossama@uci.edu> - * ace/OS.i (cuserid): + * ace/OS.i (cuserid): - When using ACE's alternate cuserid() implementation: - - ensure that the maximum length argument is non-zero - since it doesn't make sense to have a zero length user ID. - - Return a static buffer if the buffer argument is zero. This - is not reentrant but nothing else can be done in such a case. - [Bug 619] + When using ACE's alternate cuserid() implementation: + - ensure that the maximum length argument is non-zero + since it doesn't make sense to have a zero length user ID. + - Return a static buffer if the buffer argument is zero. This + is not reentrant but nothing else can be done in such a case. + [Bug 619] Mon Sep 18 11:22:02 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/SUN_Proactor.cpp (handle_events): Fixed a problem arising - on 64 bit Solaris platforms. Thanks to Ganesh Pai - <gpai@voicetek.com> for reporting this. + * ace/SUN_Proactor.cpp (handle_events): Fixed a problem arising + on 64 bit Solaris platforms. Thanks to Ganesh Pai + <gpai@voicetek.com> for reporting this. Sun Sep 17 19:17:53 2000 Carlos O'Ryan <coryan@uci.edu> diff --git a/ace/Dynamic.cpp b/ace/Dynamic.cpp index 8edf58ef62e..7dce958461d 100644 --- a/ace/Dynamic.cpp +++ b/ace/Dynamic.cpp @@ -25,6 +25,15 @@ ACE_Dynamic::instance (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex>; +# if (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) + template class ACE_TSS<ACE_Dynamic>; +# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ + #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex> + +# if (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) + #pragma instantiate ACE_TSS<ACE_Dynamic> +# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ + #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/File_Lock.cpp b/ace/File_Lock.cpp new file mode 100644 index 00000000000..be9688b510e --- /dev/null +++ b/ace/File_Lock.cpp @@ -0,0 +1,75 @@ +// $Id$ + +#include "ace/File_Lock.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/File_Lock.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, File_Lock, "$Id$") + +ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock) + +void +ACE_File_Lock::dump (void) const +{ +// ACE_TRACE ("ACE_File_Lock::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h) + : removed_ (0) +{ +// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); + if (ACE_OS::flock_init (&this->lock_) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"))); + this->set_handle (h); +} + +ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name, + int flags, + mode_t perms) +{ +// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); + + if (this->open (name, flags, perms) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p %s\n"), + ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"), + name)); +} + +int +ACE_File_Lock::open (const ACE_TCHAR *name, + int flags, + mode_t perms) +{ +// ACE_TRACE ("ACE_File_Lock::open"); + this->removed_ = 0; + return ACE_OS::flock_init (&this->lock_, flags, name, perms); +} + +ACE_File_Lock::~ACE_File_Lock (void) +{ +// ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock"); + this->remove (); +} + +// +// These are instantiated both with and without ACE_HAS_THREADS. +// +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +// template class ACE_Guard<ACE_File_Lock>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +// #pragma instantiate ACE_Guard<ACE_File_Lock> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/File_Lock.h b/ace/File_Lock.h new file mode 100644 index 00000000000..1cce6e4370b --- /dev/null +++ b/ace/File_Lock.h @@ -0,0 +1,138 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// File_Lock.h +// +// = AUTHOR +// Doug Schmidt +// +// ============================================================================ + +#ifndef ACE_FILE_LOCK_H +#define ACE_FILE_LOCK_H +#include "ace/pre.h" + +#include "ace/OS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class ACE_Export ACE_File_Lock +{ + // = TITLE + // A wrapper around the UNIX file locking mechanism. + // + // = DESCRIPTION + // Allows us to "adapt" the UNIX file locking mechanisms to work + // with all of our Guard stuff... +public: + ACE_File_Lock (ACE_HANDLE handle = ACE_INVALID_HANDLE); + // Set the <handle_> of the File_Lock to <handle>. Note that this + // constructor assumes ownership of the <handle> and will close it + // down in <remove>. If you want the <handle> stays open when + // <remove> is called make sure to call <dup> on the <handle> before + // closing it. + + ACE_File_Lock (const ACE_TCHAR *filename, int flags, mode_t mode = 0); + // Open the <filename> with <flags> and <mode> and set the result to + // <handle_>. + + int open (const ACE_TCHAR *filename, int flags, mode_t mode = 0); + // Open the <filename> with <flags> and <mode> and set the result to + // <handle_>. + + ~ACE_File_Lock (void); + // Remove a File lock by releasing it and closing down the <handle_>. + + int remove (int unlink_file = 1); + // Remove a File lock by releasing it and closing down the + // <handle_>. If <unlink_file> is non-0 then we unlink the file. + + int acquire (short whence = 0, off_t start = 0, off_t len = 1); + // Note, for interface uniformity with other synchronization + // wrappers we include the <acquire> method. This is implemented as + // a write-lock to be on the safe-side... + + int tryacquire (short whence = 0, off_t start = 0, off_t len = 1); + // Note, for interface uniformity with other synchronization + // wrappers we include the <tryacquire> method. This is implemented + // as a write-lock to be on the safe-side... Returns -1 on failure. + // If we "failed" because someone else already had the lock, <errno> + // is set to <EBUSY>. + + int release (short whence = 0, off_t start = 0, off_t len = 1); + // Unlock a readers/writer lock. + + int acquire_write (short whence = 0, off_t start = 0, off_t len = 1); + // Acquire a write lock, but block if any readers or a + // writer hold the lock. + + int tryacquire_write (short whence = 0, off_t start = 0, off_t len = 1); + // Conditionally acquire a write lock (i.e., won't block). Returns + // -1 on failure. If we "failed" because someone else already had + // the lock, <errno> is set to <EBUSY>. + + int tryacquire_write_upgrade (short whence = 0, + off_t start = 0, + off_t len = 1); + // Conditionally upgrade to a write lock (i.e., won't block). Returns + // -1 on failure. If we "failed" because someone else already had + // the lock, <errno> is set to <EBUSY>. + + int acquire_read (short whence = 0, off_t start = 0, off_t len = 1); + // Acquire a read lock, but block if a writer hold the lock. + // Returns -1 on failure. If we "failed" because someone else + // already had the lock, <errno> is set to <EBUSY>. + + int tryacquire_read (short whence = 0, off_t start = 0, off_t len = 1); + // Conditionally acquire a read lock (i.e., won't block). Returns + // -1 on failure. If we "failed" because someone else already had + // the lock, <errno> is set to <EBUSY>. + + ACE_HANDLE get_handle (void); + // Get underlying <ACE_HANDLE> for the file. + + void set_handle (ACE_HANDLE); + // Set underlying <ACE_HANDLE>. Note that this method assumes + // ownership of the <handle> and will close it down in <remove>. If + // you want the <handle> to stay open when <remove> is called make + // sure to call <dup> on the <handle> before closing it. You are + // responsible for the closing the existing <handle> before + // overwriting it. + + void dump (void) const; + // Dump state of the object. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + ACE_OS::ace_flock_t lock_; + // Locking structure for OS record locks. + + int removed_; + // Keeps track of whether <remove> has been called yet to avoid + // multiple <remove> calls, e.g., explicitly and implicitly in the + // destructor. This flag isn't protected by a lock, so make sure + // that you don't have multiple threads simultaneously calling + // <remove> on the same object, which is a bad idea anyway... + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_File_Lock &); + ACE_File_Lock (const ACE_File_Lock &); +}; + +#if defined (__ACE_INLINE__) +#include "ace/File_Lock.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* ACE_FILE_LOCK_H */ diff --git a/ace/File_Lock.inl b/ace/File_Lock.inl new file mode 100644 index 00000000000..47e97c045ab --- /dev/null +++ b/ace/File_Lock.inl @@ -0,0 +1,89 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE int +ACE_File_Lock::acquire_read (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::acquire_read"); + return ACE_OS::flock_rdlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire_read (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire_read"); + return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire_write (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire_write"); + return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire_write_upgrade (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade"); + return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire"); + return this->tryacquire_write (whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::acquire_write (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::acquire_write"); + return ACE_OS::flock_wrlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::acquire (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::acquire"); + return this->acquire_write (whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::release (short whence, off_t start, off_t len) +{ +// ACE_TRACE ("ACE_File_Lock::release"); + return ACE_OS::flock_unlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::remove (int unlink_file) +{ +// ACE_TRACE ("ACE_File_Lock::remove"); + + int result = 0; + + if (this->removed_ == 0) + { + this->removed_ = 1; + result = ACE_OS::flock_destroy (&this->lock_, + unlink_file); + } + return result; +} + +ACE_INLINE ACE_HANDLE +ACE_File_Lock::get_handle (void) +{ +// ACE_TRACE ("ACE_File_Lock::get_handle"); + return this->lock_.handle_; +} + +ACE_INLINE void +ACE_File_Lock::set_handle (ACE_HANDLE h) +{ +// ACE_TRACE ("ACE_File_Lock::set_handle"); + this->lock_.handle_ = h; + this->removed_ = 0; +} diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp index 7ef5494d116..a0959d7728b 100644 --- a/ace/Local_Name_Space.cpp +++ b/ace/Local_Name_Space.cpp @@ -6,6 +6,7 @@ #include "ace/ACE.h" #include "ace/Local_Name_Space.h" +#include "ace/RW_Process_Mutex.h" ACE_RCSID(ace, Local_Name_Space, "$Id$") @@ -71,17 +72,17 @@ ACE_NS_String::strstr (const ACE_NS_String &s) const size_t pat_len = s.len_ / sizeof (ACE_USHORT16) - 1; for (size_t i = 0; i <= len; i++) - { - size_t j; + { + size_t j; - for (j = 0; j < pat_len; j++) - if (this->rep_[i + j] != s.rep_[j]) - break; + for (j = 0; j < pat_len; j++) + if (this->rep_[i + j] != s.rep_[j]) + break; - if (j == pat_len) - // Found a match! Return the index. - return i; - } + if (j == pat_len) + // Found a match! Return the index. + return i; + } return -1; } @@ -93,7 +94,7 @@ ACE_NS_String::operator == (const ACE_NS_String &s) const ACE_TRACE ("ACE_NS_String::operator =="); return this->len_ == s.len_ && ACE_OS::memcmp ((void *) this->rep_, - (void *) s.rep_, this->len_) == 0; + (void *) s.rep_, this->len_) == 0; } int @@ -104,8 +105,8 @@ ACE_NS_String::operator != (const ACE_NS_String &s) const } ACE_NS_String::ACE_NS_String (ACE_USHORT16 *dst, - const ACE_USHORT16 *src, - size_t bytes) + const ACE_USHORT16 *src, + size_t bytes) : len_ (bytes), rep_ (dst) { @@ -116,9 +117,9 @@ ACE_NS_String::ACE_NS_String (ACE_USHORT16 *dst, size_t ACE_NS_String::hash (void) const { - return ACE::hash_pjw + return ACE::hash_pjw (ACE_reinterpret_cast (char *, ACE_const_cast (ACE_USHORT16 *, - this->rep_)), + this->rep_)), this->len_); } diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index 0a8f8309811..9c951395c78 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -225,7 +225,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::unbind_i (const ACE_WString &nam { ACE_TRACE ("ACE_Local_Name_Space::unbind"); - ACE_WRITE_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); ACE_NS_String ns_name (name); ACE_NS_Internal ns_internal; if (this->name_space_map_->unbind (ns_name, @@ -247,7 +247,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::bind (const ACE_WString &name, const char *type) { ACE_TRACE ("ACE_Local_Name_Space::bind"); - ACE_WRITE_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); return this->shared_bind (name, value, type, 0); } @@ -258,7 +258,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::rebind (const ACE_WString &name, const char *type) { ACE_TRACE ("ACE_Local_Name_Space::rebind"); - ACE_WRITE_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); return this->shared_bind (name, value, type, 1); } @@ -289,7 +289,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i (const ACE_WString &na char *&type) { ACE_TRACE ("ACE_Local_Name_Space::resolve"); - ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); ACE_NS_String ns_name (name); ACE_NS_Internal ns_internal; @@ -473,7 +473,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::create_manager_i (void) // conditions... We will use the double check here else { - ACE_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); // This is the easy case since if we find the Name Server Map // Manager we know it's already initialized. @@ -512,7 +512,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_names_i (ACE_PWSTRING_SET & const ACE_WString &pattern) { ACE_TRACE ("ACE_Local_Name_Space::list_names"); - ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); MAP_ITERATOR map_iterator (*this->name_space_map_); MAP_ENTRY *map_entry; @@ -545,7 +545,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_values_i (ACE_PWSTRING_SET const ACE_WString &pattern) { ACE_TRACE ("ACE_Local_Name_Space::list_values"); - ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); MAP_ITERATOR map_iterator (*this->name_space_map_); MAP_ENTRY *map_entry; @@ -578,7 +578,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_types_i (ACE_PWSTRING_SET & const ACE_WString &pattern) { ACE_TRACE ("ACE_Local_Name_Space::list_types"); - ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); MAP_ITERATOR map_iterator (*this->name_space_map_); MAP_ENTRY *map_entry; @@ -648,7 +648,7 @@ ACE_Local_Name_Space <ACE_MEM_POOL_2, ACE_LOCK>::list_name_entries_i (ACE_BINDIN const ACE_WString &pattern) { ACE_TRACE ("ACE_Local_Name_Space::list_name_entries"); - ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); MAP_ITERATOR map_iterator (*this->name_space_map_); MAP_ENTRY *map_entry; @@ -676,7 +676,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_value_entries_i (ACE_BINDIN const ACE_WString &pattern) { ACE_TRACE ("ACE_Local_Name_Space::list_value_entries"); - ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); MAP_ITERATOR map_iterator (*this->name_space_map_); MAP_ENTRY *map_entry; @@ -703,7 +703,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_type_entries_i (ACE_BINDING const ACE_WString &pattern) { ACE_TRACE ("ACE_Local_Name_Space::list_type_entries"); - ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, *this->lock_, -1); + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); MAP_ITERATOR map_iterator (*this->name_space_map_); MAP_ENTRY *map_entry; diff --git a/ace/MEM_SAP.h b/ace/MEM_SAP.h index 05270a74c8a..161c7330048 100644 --- a/ace/MEM_SAP.h +++ b/ace/MEM_SAP.h @@ -24,6 +24,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Process_Mutex.h" + class ACE_Export ACE_MEM_SAP { // = TITLE diff --git a/ace/Makefile b/ace/Makefile index bbf5e356a43..cdfaa2fd812 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -60,6 +60,10 @@ THREADS_FILES = \ Process_Manager \ Synch \ Synch_Options \ + Process_Semaphore \ + Process_Mutex \ + RW_Process_Mutex \ + File_Lock \ Thread \ Thread_Manager \ Thread_Adapter \ @@ -282,6 +286,10 @@ ifeq ($(ssl),1) DIRS += SSL endif # ssl +ifeq ($(rmcast),1) + DIRS += RMCast +endif # rmcast + #### #### Build customization. #### diff --git a/ace/Makefile.am b/ace/Makefile.am index a0e01d46a27..fdba8ea5db9 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -191,6 +191,10 @@ libACE_Threads_la_SOURCES = \ Process.cpp \ Process_Manager.cpp \ Synch.cpp \ + Process_Semaphore.cpp \ + Process_Mutex.cpp \ + RW_Process_Mutex.cpp \ + File_Lock.cpp \ Synch_Options.cpp \ Thread.cpp \ Thread_Adapter.cpp \ @@ -676,6 +680,10 @@ HEADER_FILES = \ Svc_Conf_Tokens.h \ Svc_Handler.h \ Synch.h \ + Process_Semaphore.h \ + Process_Mutex.h \ + RW_Process_Mutex.h \ + File_Lock.h \ Synch_Options.h \ Synch_T.h \ System_Time.h \ diff --git a/ace/Makefile.bor b/ace/Makefile.bor index 46214157983..de553c2515f 100644 --- a/ace/Makefile.bor +++ b/ace/Makefile.bor @@ -165,6 +165,10 @@ OBJFILES = \ $(OBJDIR)\Svc_Conf_y.obj \ $(OBJDIR)\Svc_Handler.obj \ $(OBJDIR)\Synch.obj \ + $(OBJDIR)\Process_Semaphore.obj \ + $(OBJDIR)\Process_Mutex.obj \ + $(OBJDIR)\RW_Process_Mutex.obj \ + $(OBJDIR)\File_Lock.obj \ $(OBJDIR)\Synch_Options.obj \ $(OBJDIR)\System_Time.obj \ $(OBJDIR)\Task.obj \ diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index 4c2f4da2b79..c6f16d9db2b 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -6,6 +6,7 @@ #include "ace/Local_Name_Space_T.h" #include "ace/Registry_Name_Space.h" #include "ace/Memory_Pool.h" +#include "ace/RW_Process_Mutex.h" ACE_RCSID(ace, Naming_Context, "$Id$") @@ -417,10 +418,10 @@ ACE_Name_Options::ACE_Name_Options (void) #else /* ACE_DEFAULT_NAMESPACE_DIR */ size_t pathsize = (MAXPATHLEN + 1) * sizeof (ACE_TCHAR); this->namespace_dir_ = ACE_static_cast (ACE_TCHAR *, ACE_OS::malloc (pathsize)); - - if (ACE::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1) + + if (ACE::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1) { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Temporary path too long, ") ACE_TEXT ("defaulting to current directory\n"))); ACE_OS::strcat (this->namespace_dir_, ACE_TEXT (".")); @@ -680,4 +681,3 @@ template class ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_LITE_M #pragma instantiate ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > > #pragma instantiate ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > > #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - diff --git a/ace/Process_Mutex.cpp b/ace/Process_Mutex.cpp new file mode 100644 index 00000000000..7d8d3500d0b --- /dev/null +++ b/ace/Process_Mutex.cpp @@ -0,0 +1,63 @@ +// $Id$ + +#include "ace/Process_Mutex.h" +#include "ace/Synch.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Process_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Process_Mutex, "$Id$") + +ACE_ALLOC_HOOK_DEFINE(ACE_Process_Mutex) + +void +ACE_Process_Mutex::dump (void) const +{ +// ACE_TRACE ("ACE_Process_Mutex::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +#if !defined (ACE_WIN32) && !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS) +const ACE_TCHAR * +ACE_Process_Mutex::unique_name (void) +{ + // 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. + ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN); + return this->name_; +} +#endif /* !ACE_WIN32 && !ACE_HAS_POSIX_SEM && !ACE_PSOS */ + +ACE_Process_Mutex::ACE_Process_Mutex (const ACE_TCHAR *name, void *arg) +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) + : lock_ (USYNC_PROCESS, name, (ACE_mutexattr_t *) arg) +#else + : lock_ (name ? name : ACE_Process_Mutex::unique_name ()) +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ +{ +#if !defined (ACE_WIN32) && !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS) + ACE_UNUSED_ARG (arg); +#endif /* !ACE_WIN32 && !ACE_HAS_POSIX_SEM && !ACE_PSOS */ +} + +ACE_Process_Mutex::~ACE_Process_Mutex (void) +{ +} + +// +// These are instantiated both with and without ACE_HAS_THREADS. +// +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Guard<ACE_Process_Mutex>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Guard<ACE_Process_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/Process_Mutex.h b/ace/Process_Mutex.h new file mode 100644 index 00000000000..1be7bd1877f --- /dev/null +++ b/ace/Process_Mutex.h @@ -0,0 +1,120 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Process_Mutex.h +// +// = DESCRIPTION +// A wrapper for mutexes that can be used across processes on +// the same host machine, as well as within a process, of +// course. +// +// = AUTHOR +// Doug Schmidt +// +// ============================================================================ + +#ifndef ACE_PROCESS_MUTEX_H +#define ACE_PROCESS_MUTEX_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !(defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)) +#include "ace/SV_Semaphore_Complex.h" +#else +#include "ace/Synch.h" +#endif /* !(ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS) */ + +class ACE_Export ACE_Process_Mutex +{ + // = TITLE + // A wrapper for mutexes that can be used across processes on + // the same host machine, as well as within a process, of + // course. +public: + ACE_Process_Mutex (const ACE_TCHAR *name = 0, + void *arg = 0); + // Create a Process_Mutex, passing in the optional <name>. + + ~ACE_Process_Mutex (void); + + int remove (void); + // Explicitly destroy the mutex. Note that only one thread should + // call this method since it doesn't protect against race + // conditions. + + int acquire (void); + // Acquire lock ownership (wait on queue if necessary). + + int tryacquire (void); + // Conditionally acquire lock (i.e., don't wait on queue). Returns + // -1 on failure. If we "failed" because someone else already had + // the lock, <errno> is set to <EBUSY>. + + int release (void); + // Release lock and unblock a thread at head of queue. + + int acquire_read (void); + // Acquire lock ownership (wait on queue if necessary). + + int acquire_write (void); + // Acquire lock ownership (wait on queue if necessary). + + int tryacquire_read (void); + // Conditionally acquire a lock (i.e., won't block). Returns -1 on + // failure. If we "failed" because someone else already had the + // lock, <errno> is set to <EBUSY>. + + int tryacquire_write (void); + // Conditionally acquire a lock (i.e., won't block). Returns -1 on + // failure. If we "failed" because someone else already had the + // lock, <errno> is set to <EBUSY>. + + int tryacquire_write_upgrade (void); + // This is only here for consistency with the other synchronization + // APIs and usability with Lock adapters. Assumes the caller already has + // acquired the mutex and returns 0 in all cases. + +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) + const ACE_mutex_t &lock (void) const; + // Return the underlying mutex. +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ + + void dump (void) const; + // Dump the state of an object. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +private: +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) + ACE_Mutex lock_; +#else + ACE_TCHAR name_[ACE_UNIQUE_NAME_LEN]; + // If the user does not provide a name we generate a unique name in + // this buffer. + + const ACE_TCHAR *unique_name (void); + // Create and return the unique name. + + ACE_SV_Semaphore_Complex lock_; + // We need this to get the right semantics... +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ +}; + +#if defined (__ACE_INLINE__) +#include "ace/Process_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* ACE_PROCESS_MUTEX_H */ diff --git a/ace/Process_Mutex.inl b/ace/Process_Mutex.inl new file mode 100644 index 00000000000..bc7b0049a7b --- /dev/null +++ b/ace/Process_Mutex.inl @@ -0,0 +1,73 @@ +/* -*- C++ -*- */ +// $Id$ + +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) +ACE_INLINE const ACE_mutex_t & +ACE_Process_Mutex::lock (void) const +{ +// ACE_TRACE ("ACE_Process_Mutex::lock"); + return this->lock_.lock (); +} +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ + +// Explicitly destroy the mutex. +ACE_INLINE int +ACE_Process_Mutex::remove (void) +{ + return this->lock_.remove (); +} + +// Acquire lock ownership (wait on priority queue if necessary). +ACE_INLINE int +ACE_Process_Mutex::acquire (void) +{ + return this->lock_.acquire (); +} + +// Conditionally acquire lock (i.e., don't wait on queue). +ACE_INLINE int +ACE_Process_Mutex::tryacquire (void) +{ + return this->lock_.tryacquire (); +} + +// Release lock and unblock a thread at head of priority queue. +ACE_INLINE int +ACE_Process_Mutex::release (void) +{ + return this->lock_.release (); +} + +// Acquire lock ownership (wait on priority queue if necessary). +ACE_INLINE int +ACE_Process_Mutex::acquire_read (void) +{ + return this->lock_.acquire_read (); +} + +// Acquire lock ownership (wait on priority queue if necessary). +ACE_INLINE int +ACE_Process_Mutex::acquire_write (void) +{ + return this->lock_.acquire_write (); +} + +// Conditionally acquire a lock (i.e., won't block). +ACE_INLINE int +ACE_Process_Mutex::tryacquire_read (void) +{ + return this->lock_.tryacquire_read (); +} + +// Conditionally acquire a lock (i.e., won't block). +ACE_INLINE int +ACE_Process_Mutex::tryacquire_write (void) +{ + return this->lock_.tryacquire_write (); +} + +ACE_INLINE int +ACE_Process_Mutex::tryacquire_write_upgrade (void) +{ + return 0; +} diff --git a/ace/Process_Semaphore.cpp b/ace/Process_Semaphore.cpp new file mode 100644 index 00000000000..ebc036b509b --- /dev/null +++ b/ace/Process_Semaphore.cpp @@ -0,0 +1,91 @@ +// $Id$ + +#include "ace/Process_Semaphore.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Process_Semaphore.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Process_Semaphore, "$Id$") + +void +ACE_Process_Semaphore::dump (void) const +{ +// ACE_TRACE ("ACE_Process_Semaphore::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, + const ACE_TCHAR *name, + void *arg, + int max) +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) + : lock_ (count, USYNC_PROCESS, name, arg, max) +#else + : lock_ (name, ACE_SV_Semaphore_Complex::ACE_CREATE, count) +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ +{ + arg = arg; + max = max; +// ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); +} + +ACE_Process_Semaphore::~ACE_Process_Semaphore (void) +{ + // ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore"); +} + +// Explicitly destroy the semaphore. + +int +ACE_Process_Semaphore::remove (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::remove"); + return this->lock_.remove (); +} + +// Block the thread until the semaphore count becomes +// greater than 0, then decrement it. + +int +ACE_Process_Semaphore::acquire (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::acquire"); + return this->lock_.acquire (); +} + +// Conditionally decrement the semaphore if count is greater +// than 0 (i.e., won't block). + +int +ACE_Process_Semaphore::tryacquire (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::tryacquire"); + return this->lock_.tryacquire (); +} + +// Increment the semaphore, potentially unblocking +// a waiting thread. + +int +ACE_Process_Semaphore::release (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::release"); + return this->lock_.release (); +} + +// +// These are instantiated both with and without ACE_HAS_THREADS. +// +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +// template class ACE_Guard<ACE_Process_Semaphore>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +// #pragma instantiate ACE_Guard<ACE_Process_Semaphore> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/Process_Semaphore.h b/ace/Process_Semaphore.h new file mode 100644 index 00000000000..95a7c07a0f3 --- /dev/null +++ b/ace/Process_Semaphore.h @@ -0,0 +1,126 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Process_Semaphore.h +// +// = DESCRIPTION +// Wrapper for Dijkstra style general semaphores that work +// across processes. +// +// = AUTHOR +// Doug Schmidt +// +// ============================================================================ + +#ifndef ACE_PROCESS_SEMAPHORE_H +#define ACE_PROCESS_SEMAPHORE_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !(defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)) +#include "ace/SV_Semaphore_Complex.h" +#endif /* !(ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS) */ + +class ACE_Export ACE_Process_Semaphore +{ + // = TITLE + // Wrapper for Dijkstra style general semaphores that work + // across processes. +public: + ACE_Process_Semaphore (u_int count = 1, // By default make this unlocked. + const ACE_TCHAR *name = 0, + void * = 0, + int max = 0x7FFFFFFF); + // Initialize the semaphore, with an initial value of <count> and a + // maximum value of <max>. + + ~ACE_Process_Semaphore (void); + // This method is a no-op, i.e., it doesn't remove the semaphore. + // If you want to remove the semaphore, you must call the <remove> + // method explicitly. + + int remove (void); + // Explicitly destroy the semaphore. Note that only one thread + // should call this method since it doesn't protect against race + // conditions. + + int acquire (void); + // Block the thread until the semaphore count becomes greater than + // 0, then decrement it. + + int tryacquire (void); + // Conditionally decrement the semaphore if count is greater than 0 + // (i.e., won't block). Returns -1 on failure. If we "failed" + // because someone else already had the lock, <errno> is set to + // <EBUSY>. + + int release (void); + // Increment the semaphore, potentially unblocking a waiting thread. + + int acquire_read (void); + // Acquire semaphore ownership. This calls <acquire> and is only + // here to make the <ACE_Process_Semaphore> interface consistent + // with the other synchronization APIs. + + int acquire_write (void); + // Acquire semaphore ownership. This calls <acquire> and is only + // here to make the <ACE_Process_Semaphore> interface consistent + // with the other synchronization APIs. + + int tryacquire_read (void); + // Conditionally acquire semaphore (i.e., won't block). This calls + // <tryacquire> and is only here to make the <ACE_Process_Semaphore> + // interface consistent with the other synchronization APIs. + // Returns -1 on failure. If we "failed" because someone else + // already had the lock, <errno> is set to <EBUSY>. + + int tryacquire_write (void); + // Conditionally acquire semaphore (i.e., won't block). This calls + // <tryacquire> and is only here to make the <ACE_Process_Semaphore> + // interface consistent with the other synchronization APIs. + // Returns -1 on failure. If we "failed" because someone else + // already had the lock, <errno> is set to <EBUSY>. + + int tryacquire_write_upgrade (void); + // This is only here to make the <ACE_Process_Semaphore> + // interface consistent with the other synchronization APIs. + // Assumes the caller has already acquired the semaphore using one of + // the above calls, and returns 0 (success) always. + +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) + const ACE_sema_t &lock (void) const; + // Return the underlying lock. +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ + + void dump (void) const; + // Dump the state of an object. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) + ACE_Semaphore lock_; +#else + ACE_SV_Semaphore_Complex lock_; + // We need this to get the right semantics... +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ +}; + +#if defined (__ACE_INLINE__) +#include "ace/Process_Semaphore.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* ACE_PROCESS_SEMAPHORE_H */ diff --git a/ace/Process_Semaphore.inl b/ace/Process_Semaphore.inl new file mode 100644 index 00000000000..8470291233c --- /dev/null +++ b/ace/Process_Semaphore.inl @@ -0,0 +1,61 @@ +/* -*- C++ -*- */ +// $Id$ + +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) +ACE_INLINE const ACE_sema_t & +ACE_Process_Semaphore::lock (void) const +{ +// ACE_TRACE ("ACE_Process_Semaphore::lock"); + return this->lock_.lock (); +} +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ + +// Acquire semaphore ownership. This calls <acquire> and is only here +// to make the <ACE_Process_Semaphore> interface consistent with the +// other synchronization APIs. + +ACE_INLINE int +ACE_Process_Semaphore::acquire_read (void) +{ + return this->acquire (); +} + +// Acquire semaphore ownership. This calls <acquire> and is only here +// to make the <ACE_Process_Semaphore> interface consistent with the +// other synchronization APIs. + +ACE_INLINE int +ACE_Process_Semaphore::acquire_write (void) +{ + return this->acquire (); +} + +// Conditionally acquire semaphore (i.e., won't block). This calls +// <tryacquire> and is only here to make the <ACE_Process_Semaphore> +// interface consistent with the other synchronization APIs. + +ACE_INLINE int +ACE_Process_Semaphore::tryacquire_read (void) +{ + return this->tryacquire (); +} + +// Conditionally acquire semaphore (i.e., won't block). This calls +// <tryacquire> and is only here to make the <ACE_Process_Semaphore> +// interface consistent with the other synchronization APIs. + +ACE_INLINE int +ACE_Process_Semaphore::tryacquire_write (void) +{ + return this->tryacquire (); +} + +// This is only here to make the <ACE_Process_Semaphore> +// interface consistent with the other synchronization APIs. +// Assumes the caller has already acquired the semaphore using one of +// the above calls, and returns 0 (success) always. +ACE_INLINE int +ACE_Process_Semaphore::tryacquire_write_upgrade (void) +{ + return 0; +} diff --git a/ace/RW_Process_Mutex.cpp b/ace/RW_Process_Mutex.cpp new file mode 100644 index 00000000000..096c46e7ae1 --- /dev/null +++ b/ace/RW_Process_Mutex.cpp @@ -0,0 +1,51 @@ +// $Id$ + +#include "ace/RW_Process_Mutex.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, RW_Process_Mutex, "$Id$") + +#if !defined (__ACE_INLINE__) +#include "ace/RW_Process_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +ACE_ALLOC_HOOK_DEFINE(ACE_RW_Process_Mutex) + +ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name, + int flags) + : lock_ (name, flags +#if defined (ACE_WIN32) + ) +#else + , S_IRUSR | S_IWUSR) +#endif /* ACE_WIN32 */ +{ +// ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); +} + +ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex (void) +{ +// ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); +} + +void +ACE_RW_Process_Mutex::dump (void) const +{ +// ACE_TRACE ("ACE_RW_Process_Mutex::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +// +// These are instantiated both with and without ACE_HAS_THREADS. +// +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +// template class ACE_Guard<ACE_RW_Process_Mutex>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +// #pragma instantiate ACE_Guard<ACE_RW_Process_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/RW_Process_Mutex.h b/ace/RW_Process_Mutex.h new file mode 100644 index 00000000000..51e1dbf6c75 --- /dev/null +++ b/ace/RW_Process_Mutex.h @@ -0,0 +1,101 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// RW_Process_Mutex.h +// +// = AUTHOR +// Doug Schmidt +// +// ============================================================================ + +#ifndef ACE_RW_PROCESS_MUTEX_H +#define ACE_RW_PROCESS_MUTEX_H +#include "ace/pre.h" + +#include "ace/File_Lock.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class ACE_Export ACE_RW_Process_Mutex +{ + // = TITLE + // Wrapper for readers/writer locks that exist across processes. + // + // = DESCRIPTION + // Note that because this class uses the + // <ACE_File_Lock> as its implementation it only can be reliably + // used between separate processes, rather than threads in the + // same process. This isn't a limitation of ACE, it's simply + // the file lock semantics on UNIX and Win32. +public: + ACE_RW_Process_Mutex (const ACE_TCHAR *name = 0, + int flags = O_CREAT|O_RDWR); + // Create a readers/writer <Process_Mutex>, passing in the optional + // <name>. + + ~ACE_RW_Process_Mutex (void); + + int remove (void); + // Explicitly destroy the mutex. Note that only one thread should + // call this method since it doesn't protect against race + // conditions. + + int acquire (void); + // Acquire lock ownership (wait on queue if necessary). + + int tryacquire (void); + // Conditionally acquire lock (i.e., don't wait on queue). Returns + // -1 on failure. If we "failed" because someone else already had + // the lock, <errno> is set to <EBUSY>. + + int release (void); + // Release lock and unblock a thread at head of queue. + + int acquire_read (void); + // Acquire lock ownership (wait on queue if necessary). + + int acquire_write (void); + // Acquire lock ownership (wait on queue if necessary). + + int tryacquire_read (void); + // Conditionally acquire a lock (i.e., won't block). Returns -1 on + // failure. If we "failed" because someone else already had the + // lock, <errno> is set to <EBUSY>. + + int tryacquire_write (void); + // Conditionally acquire a lock (i.e., won't block). Returns -1 on + // failure. If we "failed" because someone else already had the + // lock, <errno> is set to <EBUSY>. + + int tryacquire_write_upgrade (void); + // Attempt to upgrade a read lock to a write lock. Returns 0 on + // success, -1 on failure. + + const ACE_File_Lock &lock (void) const; + // Return the underlying lock. + + void dump (void) const; + // Dump the state of an object. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +private: + ACE_File_Lock lock_; + // We need this to get the readers/writer semantics... +}; + +#if defined (__ACE_INLINE__) +#include "ace/RW_Process_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* ACE_RW_PROCESS_MUTEX_H */ diff --git a/ace/RW_Process_Mutex.inl b/ace/RW_Process_Mutex.inl new file mode 100644 index 00000000000..cc59bb9fc17 --- /dev/null +++ b/ace/RW_Process_Mutex.inl @@ -0,0 +1,72 @@ +/* -*- C++ -*- */ +// $Id$ + +// Explicitly destroy the mutex. +ACE_INLINE int +ACE_RW_Process_Mutex::remove (void) +{ + return this->lock_.remove (); +} + +// Acquire lock ownership (wait on priority queue if necessary). +ACE_INLINE int +ACE_RW_Process_Mutex::acquire (void) +{ + return this->lock_.acquire (); +} + +// Conditionally acquire lock (i.e., don't wait on queue). +ACE_INLINE int +ACE_RW_Process_Mutex::tryacquire (void) +{ + return this->lock_.tryacquire (); +} + +// Release lock and unblock a thread at head of priority queue. +ACE_INLINE int +ACE_RW_Process_Mutex::release (void) +{ + return this->lock_.release (); +} + +// Acquire lock ownership (wait on priority queue if necessary). +ACE_INLINE int +ACE_RW_Process_Mutex::acquire_read (void) +{ + return this->lock_.acquire_read (); +} + +// Acquire lock ownership (wait on priority queue if necessary). +ACE_INLINE int +ACE_RW_Process_Mutex::acquire_write (void) +{ + return this->lock_.acquire_write (); +} + +// Conditionally acquire a lock (i.e., won't block). +ACE_INLINE int +ACE_RW_Process_Mutex::tryacquire_read (void) +{ + return this->lock_.tryacquire_read (); +} + +// Conditionally acquire a lock (i.e., won't block). +ACE_INLINE int +ACE_RW_Process_Mutex::tryacquire_write (void) +{ + return this->lock_.tryacquire_write (); +} + +// Conditionally upgrade a lock (i.e., won't block). +ACE_INLINE int +ACE_RW_Process_Mutex::tryacquire_write_upgrade (void) +{ + return this->lock_.tryacquire_write_upgrade (); +} + +ACE_INLINE const ACE_File_Lock & +ACE_RW_Process_Mutex::lock (void) const +{ +// ACE_TRACE ("ACE_RW_Process_Mutex::lock"); + return this->lock_; +} diff --git a/ace/Synch.cpp b/ace/Synch.cpp index 63a8e658b91..b9987fb97a7 100644 --- a/ace/Synch.cpp +++ b/ace/Synch.cpp @@ -20,9 +20,6 @@ ACE_RCSID(ace, Synch, "$Id$") #endif /* __ACE_INLINE__ */ ACE_ALLOC_HOOK_DEFINE(ACE_Null_Mutex) -ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock) -ACE_ALLOC_HOOK_DEFINE(ACE_RW_Process_Mutex) -ACE_ALLOC_HOOK_DEFINE(ACE_Process_Mutex) ACE_Lock::~ACE_Lock (void) { @@ -125,95 +122,6 @@ ACE_TSS_C_cleanup (void *object) } } -void -ACE_Process_Mutex::dump (void) const -{ -// ACE_TRACE ("ACE_Process_Mutex::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -#if !defined (ACE_WIN32) && !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS) -const ACE_TCHAR * -ACE_Process_Mutex::unique_name (void) -{ - // 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. - ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN); - return this->name_; -} -#endif /* !ACE_WIN32 && !ACE_HAS_POSIX_SEM && !ACE_PSOS */ - -ACE_Process_Mutex::ACE_Process_Mutex (const ACE_TCHAR *name, void *arg) -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) - : lock_ (USYNC_PROCESS, name, (ACE_mutexattr_t *) arg) -#else - : lock_ (name ? name : ACE_Process_Mutex::unique_name ()) -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ -{ -#if !defined (ACE_WIN32) && !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS) - ACE_UNUSED_ARG (arg); -#endif /* !ACE_WIN32 && !ACE_HAS_POSIX_SEM && !ACE_PSOS */ -} - -ACE_Process_Mutex::~ACE_Process_Mutex (void) -{ -} - -ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name, - int flags) - : lock_ (name, flags -#if defined (ACE_WIN32) - ) -#else - , S_IRUSR | S_IWUSR) -#endif /* ACE_WIN32 */ -{ -// ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); -} - -ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex (void) -{ -// ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); -} - -void -ACE_RW_Process_Mutex::dump (void) const -{ -// ACE_TRACE ("ACE_RW_Process_Mutex::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -void -ACE_RW_Mutex::dump (void) const -{ -// ACE_TRACE ("ACE_RW_Mutex::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -ACE_RW_Mutex::ACE_RW_Mutex (int type, const ACE_TCHAR *name, void *arg) - : removed_ (0) -{ -// ACE_TRACE ("ACE_RW_Mutex::ACE_RW_Mutex"); - if (ACE_OS::rwlock_init (&this->lock_, type, name, arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT("%p\n"), - ACE_TEXT("ACE_RW_Mutex::ACE_RW_Mutex"))); -} - -ACE_RW_Mutex::~ACE_RW_Mutex (void) -{ -// ACE_TRACE ("ACE_RW_Mutex::~ACE_RW_Mutex"); - this->remove (); -} - ACE_ALLOC_HOOK_DEFINE(ACE_Semaphore) void @@ -248,124 +156,6 @@ ACE_Semaphore::~ACE_Semaphore (void) this->remove (); } -void -ACE_File_Lock::dump (void) const -{ -// ACE_TRACE ("ACE_File_Lock::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h) - : removed_ (0) -{ -// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); - if (ACE_OS::flock_init (&this->lock_) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"))); - this->set_handle (h); -} - -ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name, - int flags, - mode_t perms) -{ -// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); - - if (this->open (name, flags, perms) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p %s\n"), - ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"), - name)); -} - -int -ACE_File_Lock::open (const ACE_TCHAR *name, - int flags, - mode_t perms) -{ -// ACE_TRACE ("ACE_File_Lock::open"); - this->removed_ = 0; - return ACE_OS::flock_init (&this->lock_, flags, name, perms); -} - -ACE_File_Lock::~ACE_File_Lock (void) -{ -// ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock"); - this->remove (); -} - -void -ACE_Process_Semaphore::dump (void) const -{ -// ACE_TRACE ("ACE_Process_Semaphore::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, - const ACE_TCHAR *name, - void *arg, - int max) -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) - : lock_ (count, USYNC_PROCESS, name, arg, max) -#else - : lock_ (name, ACE_SV_Semaphore_Complex::ACE_CREATE, count) -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ -{ - arg = arg; - max = max; -// ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); -} - -ACE_Process_Semaphore::~ACE_Process_Semaphore (void) -{ - // ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore"); -} - -// Explicitly destroy the semaphore. - -int -ACE_Process_Semaphore::remove (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::remove"); - return this->lock_.remove (); -} - -// Block the thread until the semaphore count becomes -// greater than 0, then decrement it. - -int -ACE_Process_Semaphore::acquire (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::acquire"); - return this->lock_.acquire (); -} - -// Conditionally decrement the semaphore if count is greater -// than 0 (i.e., won't block). - -int -ACE_Process_Semaphore::tryacquire (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::tryacquire"); - return this->lock_.tryacquire (); -} - -// Increment the semaphore, potentially unblocking -// a waiting thread. - -int -ACE_Process_Semaphore::release (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::release"); - return this->lock_.release (); -} - ACE_ALLOC_HOOK_DEFINE(ACE_Mutex) void @@ -1004,6 +794,32 @@ ACE_Thread_Mutex::ACE_Thread_Mutex (const ACE_TCHAR *name, ACE_mutexattr_t *arg) ACE_TEXT ("ACE_Thread_Mutex::ACE_Thread_Mutex"))); } +void +ACE_RW_Mutex::dump (void) const +{ +// ACE_TRACE ("ACE_RW_Mutex::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +ACE_RW_Mutex::ACE_RW_Mutex (int type, const ACE_TCHAR *name, void *arg) + : removed_ (0) +{ +// ACE_TRACE ("ACE_RW_Mutex::ACE_RW_Mutex"); + if (ACE_OS::rwlock_init (&this->lock_, type, name, arg) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT("%p\n"), + ACE_TEXT("ACE_RW_Mutex::ACE_RW_Mutex"))); +} + +ACE_RW_Mutex::~ACE_RW_Mutex (void) +{ +// ACE_TRACE ("ACE_RW_Mutex::~ACE_RW_Mutex"); + this->remove (); +} + ACE_ALLOC_HOOK_DEFINE(ACE_RW_Thread_Mutex) ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex (const ACE_TCHAR *name, @@ -1045,12 +861,8 @@ template class ACE_Write_Guard<ACE_Thread_Mutex>; // #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Guard<ACE_Process_Mutex>; - #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Guard<ACE_Process_Mutex> - #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ACE_SYNCH_C */ diff --git a/ace/Synch.h b/ace/Synch.h index 57edfb55250..026844e82e5 100644 --- a/ace/Synch.h +++ b/ace/Synch.h @@ -27,10 +27,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#if !(defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)) -#include "ace/SV_Semaphore_Complex.h" -#endif /* !(ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS) */ - // Forward declarations. class ACE_Time_Value; // template <class ACE_COND_MUTEX> class ACE_Condition; @@ -142,112 +138,6 @@ protected: ACE_Lock *lock_; }; -class ACE_Export ACE_File_Lock -{ - // = TITLE - // A wrapper around the UNIX file locking mechanism. - // - // = DESCRIPTION - // Allows us to "adapt" the UNIX file locking mechanisms to work - // with all of our Guard stuff... -public: - ACE_File_Lock (ACE_HANDLE handle = ACE_INVALID_HANDLE); - // Set the <handle_> of the File_Lock to <handle>. Note that this - // constructor assumes ownership of the <handle> and will close it - // down in <remove>. If you want the <handle> stays open when - // <remove> is called make sure to call <dup> on the <handle> before - // closing it. - - ACE_File_Lock (const ACE_TCHAR *filename, int flags, mode_t mode = 0); - // Open the <filename> with <flags> and <mode> and set the result to - // <handle_>. - - int open (const ACE_TCHAR *filename, int flags, mode_t mode = 0); - // Open the <filename> with <flags> and <mode> and set the result to - // <handle_>. - - ~ACE_File_Lock (void); - // Remove a File lock by releasing it and closing down the <handle_>. - - int remove (int unlink_file = 1); - // Remove a File lock by releasing it and closing down the - // <handle_>. If <unlink_file> is non-0 then we unlink the file. - - int acquire (short whence = 0, off_t start = 0, off_t len = 1); - // Note, for interface uniformity with other synchronization - // wrappers we include the <acquire> method. This is implemented as - // a write-lock to be on the safe-side... - - int tryacquire (short whence = 0, off_t start = 0, off_t len = 1); - // Note, for interface uniformity with other synchronization - // wrappers we include the <tryacquire> method. This is implemented - // as a write-lock to be on the safe-side... Returns -1 on failure. - // If we "failed" because someone else already had the lock, <errno> - // is set to <EBUSY>. - - int release (short whence = 0, off_t start = 0, off_t len = 1); - // Unlock a readers/writer lock. - - int acquire_write (short whence = 0, off_t start = 0, off_t len = 1); - // Acquire a write lock, but block if any readers or a - // writer hold the lock. - - int tryacquire_write (short whence = 0, off_t start = 0, off_t len = 1); - // Conditionally acquire a write lock (i.e., won't block). Returns - // -1 on failure. If we "failed" because someone else already had - // the lock, <errno> is set to <EBUSY>. - - int tryacquire_write_upgrade (short whence = 0, - off_t start = 0, - off_t len = 1); - // Conditionally upgrade to a write lock (i.e., won't block). Returns - // -1 on failure. If we "failed" because someone else already had - // the lock, <errno> is set to <EBUSY>. - - int acquire_read (short whence = 0, off_t start = 0, off_t len = 1); - // Acquire a read lock, but block if a writer hold the lock. - // Returns -1 on failure. If we "failed" because someone else - // already had the lock, <errno> is set to <EBUSY>. - - int tryacquire_read (short whence = 0, off_t start = 0, off_t len = 1); - // Conditionally acquire a read lock (i.e., won't block). Returns - // -1 on failure. If we "failed" because someone else already had - // the lock, <errno> is set to <EBUSY>. - - ACE_HANDLE get_handle (void); - // Get underlying <ACE_HANDLE> for the file. - - void set_handle (ACE_HANDLE); - // Set underlying <ACE_HANDLE>. Note that this method assumes - // ownership of the <handle> and will close it down in <remove>. If - // you want the <handle> to stay open when <remove> is called make - // sure to call <dup> on the <handle> before closing it. You are - // responsible for the closing the existing <handle> before - // overwriting it. - - void dump (void) const; - // Dump state of the object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: - ACE_OS::ace_flock_t lock_; - // Locking structure for OS record locks. - - int removed_; - // Keeps track of whether <remove> has been called yet to avoid - // multiple <remove> calls, e.g., explicitly and implicitly in the - // destructor. This flag isn't protected by a lock, so make sure - // that you don't have multiple threads simultaneously calling - // <remove> on the same object, which is a bad idea anyway... - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_File_Lock &); - ACE_File_Lock (const ACE_File_Lock &); -}; - class ACE_Export ACE_Semaphore { // = TITLE @@ -355,92 +245,6 @@ private: ACE_Semaphore (const ACE_Semaphore &); }; -class ACE_Export ACE_Process_Semaphore -{ - // = TITLE - // Wrapper for Dijkstra style general semaphores that work - // across processes. -public: - ACE_Process_Semaphore (u_int count = 1, // By default make this unlocked. - const ACE_TCHAR *name = 0, - void * = 0, - int max = 0x7FFFFFFF); - // Initialize the semaphore, with an initial value of <count> and a - // maximum value of <max>. - - ~ACE_Process_Semaphore (void); - // This method is a no-op, i.e., it doesn't remove the semaphore. - // If you want to remove the semaphore, you must call the <remove> - // method explicitly. - - int remove (void); - // Explicitly destroy the semaphore. Note that only one thread - // should call this method since it doesn't protect against race - // conditions. - - int acquire (void); - // Block the thread until the semaphore count becomes greater than - // 0, then decrement it. - - int tryacquire (void); - // Conditionally decrement the semaphore if count is greater than 0 - // (i.e., won't block). Returns -1 on failure. If we "failed" - // because someone else already had the lock, <errno> is set to - // <EBUSY>. - - int release (void); - // Increment the semaphore, potentially unblocking a waiting thread. - - int acquire_read (void); - // Acquire semaphore ownership. This calls <acquire> and is only - // here to make the <ACE_Process_Semaphore> interface consistent - // with the other synchronization APIs. - - int acquire_write (void); - // Acquire semaphore ownership. This calls <acquire> and is only - // here to make the <ACE_Process_Semaphore> interface consistent - // with the other synchronization APIs. - - int tryacquire_read (void); - // Conditionally acquire semaphore (i.e., won't block). This calls - // <tryacquire> and is only here to make the <ACE_Process_Semaphore> - // interface consistent with the other synchronization APIs. - // Returns -1 on failure. If we "failed" because someone else - // already had the lock, <errno> is set to <EBUSY>. - - int tryacquire_write (void); - // Conditionally acquire semaphore (i.e., won't block). This calls - // <tryacquire> and is only here to make the <ACE_Process_Semaphore> - // interface consistent with the other synchronization APIs. - // Returns -1 on failure. If we "failed" because someone else - // already had the lock, <errno> is set to <EBUSY>. - - int tryacquire_write_upgrade (void); - // This is only here to make the <ACE_Process_Semaphore> - // interface consistent with the other synchronization APIs. - // Assumes the caller has already acquired the semaphore using one of - // the above calls, and returns 0 (success) always. - -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) - const ACE_sema_t &lock (void) const; - // Return the underlying lock. -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) - ACE_Semaphore lock_; -#else - ACE_SV_Semaphore_Complex lock_; - // We need this to get the right semantics... -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ -}; - class ACE_Export ACE_Null_Semaphore { // = TITLE @@ -654,152 +458,6 @@ private: ACE_Mutex (const ACE_Mutex &); }; -class ACE_Export ACE_Process_Mutex -{ - // = TITLE - // A wrapper for mutexes that can be used across processes on - // the same host machine, as well as within a process, of - // course. -public: - ACE_Process_Mutex (const ACE_TCHAR *name = 0, - void *arg = 0); - // Create a Process_Mutex, passing in the optional <name>. - - ~ACE_Process_Mutex (void); - - int remove (void); - // Explicitly destroy the mutex. Note that only one thread should - // call this method since it doesn't protect against race - // conditions. - - int acquire (void); - // Acquire lock ownership (wait on queue if necessary). - - int tryacquire (void); - // Conditionally acquire lock (i.e., don't wait on queue). Returns - // -1 on failure. If we "failed" because someone else already had - // the lock, <errno> is set to <EBUSY>. - - int release (void); - // Release lock and unblock a thread at head of queue. - - int acquire_read (void); - // Acquire lock ownership (wait on queue if necessary). - - int acquire_write (void); - // Acquire lock ownership (wait on queue if necessary). - - int tryacquire_read (void); - // Conditionally acquire a lock (i.e., won't block). Returns -1 on - // failure. If we "failed" because someone else already had the - // lock, <errno> is set to <EBUSY>. - - int tryacquire_write (void); - // Conditionally acquire a lock (i.e., won't block). Returns -1 on - // failure. If we "failed" because someone else already had the - // lock, <errno> is set to <EBUSY>. - - int tryacquire_write_upgrade (void); - // This is only here for consistency with the other synchronization - // APIs and usability with Lock adapters. Assumes the caller already has - // acquired the mutex and returns 0 in all cases. - -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) - const ACE_mutex_t &lock (void) const; - // Return the underlying mutex. -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -private: -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) - ACE_Mutex lock_; -#else - ACE_TCHAR name_[ACE_UNIQUE_NAME_LEN]; - // If the user does not provide a name we generate a unique name in - // this buffer. - - const ACE_TCHAR *unique_name (void); - // Create and return the unique name. - - ACE_SV_Semaphore_Complex lock_; - // We need this to get the right semantics... -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ -}; - -class ACE_Export ACE_RW_Process_Mutex -{ - // = TITLE - // Wrapper for readers/writer locks that exist across processes. - // - // = DESCRIPTION - // Note that because this class uses the - // <ACE_File_Lock> as its implementation it only can be reliably - // used between separate processes, rather than threads in the - // same process. This isn't a limitation of ACE, it's simply - // the file lock semantics on UNIX and Win32. -public: - ACE_RW_Process_Mutex (const ACE_TCHAR *name = 0, - int flags = O_CREAT|O_RDWR); - // Create a readers/writer <Process_Mutex>, passing in the optional - // <name>. - - ~ACE_RW_Process_Mutex (void); - - int remove (void); - // Explicitly destroy the mutex. Note that only one thread should - // call this method since it doesn't protect against race - // conditions. - - int acquire (void); - // Acquire lock ownership (wait on queue if necessary). - - int tryacquire (void); - // Conditionally acquire lock (i.e., don't wait on queue). Returns - // -1 on failure. If we "failed" because someone else already had - // the lock, <errno> is set to <EBUSY>. - - int release (void); - // Release lock and unblock a thread at head of queue. - - int acquire_read (void); - // Acquire lock ownership (wait on queue if necessary). - - int acquire_write (void); - // Acquire lock ownership (wait on queue if necessary). - - int tryacquire_read (void); - // Conditionally acquire a lock (i.e., won't block). Returns -1 on - // failure. If we "failed" because someone else already had the - // lock, <errno> is set to <EBUSY>. - - int tryacquire_write (void); - // Conditionally acquire a lock (i.e., won't block). Returns -1 on - // failure. If we "failed" because someone else already had the - // lock, <errno> is set to <EBUSY>. - - int tryacquire_write_upgrade (void); - // Attempt to upgrade a read lock to a write lock. Returns 0 on - // success, -1 on failure. - - const ACE_File_Lock &lock (void) const; - // Return the underlying lock. - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -private: - ACE_File_Lock lock_; - // We need this to get the readers/writer semantics... -}; - class ACE_Export ACE_Null_Barrier { // = TITLE @@ -909,7 +567,7 @@ class ACE_Export ACE_Null_Mutex_Guard // // = DESCRIPTION // This class is obsolete and should be replaced by - // ACE_Guard<ACE_Null_Mutex>. + // ACE_Guard<ACE_Null_Mutex>. public: ACE_Null_Mutex_Guard (ACE_Null_Mutex &); ~ACE_Null_Mutex_Guard (void); @@ -1131,7 +789,7 @@ class ACE_Export ACE_Thread_Mutex // recursive mutex. friend class ACE_Condition_Thread_Mutex; public: - ACE_Thread_Mutex (const ACE_TCHAR *name = 0, + ACE_Thread_Mutex (const ACE_TCHAR *name = 0, ACE_mutexattr_t *attributes = 0); // Constructor. @@ -1220,7 +878,7 @@ class ACE_Export ACE_Thread_Mutex_Guard // // = DESCRIPTION // This class is obsolete and should be replaced by - // ACE_Guard<ACE_Thread_Mutex>. + // ACE_Guard<ACE_Thread_Mutex>. public: ACE_Thread_Mutex_Guard (ACE_Thread_Mutex &m, int block = 1); // Implicitly and automatically acquire the lock. @@ -1686,6 +1344,13 @@ public: // Include the templates here. #include "ace/Synch_T.h" +#if !defined (ACE_ONLY_LATEST_AND_GREATEST) +# include "ace/File_Lock.h" +# include "ace/Process_Semaphore.h" +# include "ace/Process_Mutex.h" +# include "ace/RW_Process_Mutex.h" +#endif /* ACE_ONLY_LATEST_AND_GREATEST */ + template <class ACE_LOCK> class ACE_Guard; diff --git a/ace/Synch.i b/ace/Synch.i index 79b0f9ed2bf..1c9714d5b39 100644 --- a/ace/Synch.i +++ b/ace/Synch.i @@ -6,93 +6,6 @@ ACE_Lock::ACE_Lock (void) { } -ACE_INLINE int -ACE_File_Lock::acquire_read (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire_read"); - return ACE_OS::flock_rdlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_read (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_read"); - return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_write (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_write"); - return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_write_upgrade (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade"); - return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire"); - return this->tryacquire_write (whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::acquire_write (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire_write"); - return ACE_OS::flock_wrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::acquire (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire"); - return this->acquire_write (whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::release (short whence, off_t start, off_t len) -{ -// ACE_TRACE ("ACE_File_Lock::release"); - return ACE_OS::flock_unlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::remove (int unlink_file) -{ -// ACE_TRACE ("ACE_File_Lock::remove"); - - int result = 0; - - if (this->removed_ == 0) - { - this->removed_ = 1; - result = ACE_OS::flock_destroy (&this->lock_, - unlink_file); - } - return result; -} - -ACE_INLINE ACE_HANDLE -ACE_File_Lock::get_handle (void) -{ -// ACE_TRACE ("ACE_File_Lock::get_handle"); - return this->lock_.handle_; -} - -ACE_INLINE void -ACE_File_Lock::set_handle (ACE_HANDLE h) -{ -// ACE_TRACE ("ACE_File_Lock::set_handle"); - this->lock_.handle_ = h; - this->removed_ = 0; -} - ACE_INLINE const ACE_rwlock_t & ACE_RW_Mutex::lock (void) const { @@ -420,72 +333,6 @@ ACE_Semaphore::tryacquire_write_upgrade (void) return 0; } -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) -ACE_INLINE const ACE_mutex_t & -ACE_Process_Mutex::lock (void) const -{ -// ACE_TRACE ("ACE_Process_Mutex::lock"); - return this->lock_.lock (); -} - -ACE_INLINE const ACE_sema_t & -ACE_Process_Semaphore::lock (void) const -{ -// ACE_TRACE ("ACE_Process_Semaphore::lock"); - return this->lock_.lock (); -} -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ - -// Acquire semaphore ownership. This calls <acquire> and is only here -// to make the <ACE_Process_Semaphore> interface consistent with the -// other synchronization APIs. - -ACE_INLINE int -ACE_Process_Semaphore::acquire_read (void) -{ - return this->acquire (); -} - -// Acquire semaphore ownership. This calls <acquire> and is only here -// to make the <ACE_Process_Semaphore> interface consistent with the -// other synchronization APIs. - -ACE_INLINE int -ACE_Process_Semaphore::acquire_write (void) -{ - return this->acquire (); -} - -// Conditionally acquire semaphore (i.e., won't block). This calls -// <tryacquire> and is only here to make the <ACE_Process_Semaphore> -// interface consistent with the other synchronization APIs. - -ACE_INLINE int -ACE_Process_Semaphore::tryacquire_read (void) -{ - return this->tryacquire (); -} - -// Conditionally acquire semaphore (i.e., won't block). This calls -// <tryacquire> and is only here to make the <ACE_Process_Semaphore> -// interface consistent with the other synchronization APIs. - -ACE_INLINE int -ACE_Process_Semaphore::tryacquire_write (void) -{ - return this->tryacquire (); -} - -// This is only here to make the <ACE_Process_Semaphore> -// interface consistent with the other synchronization APIs. -// Assumes the caller has already acquired the semaphore using one of -// the above calls, and returns 0 (success) always. -ACE_INLINE int -ACE_Process_Semaphore::tryacquire_write_upgrade (void) -{ - return 0; -} - // Null ACE_Semaphore implementation ACE_INLINE @@ -815,138 +662,6 @@ ACE_Recursive_Thread_Mutex::tryacquire_write_upgrade (void) #endif /* ACE_HAS_THREADS */ -// Explicitly destroy the mutex. -ACE_INLINE int -ACE_Process_Mutex::remove (void) -{ - return this->lock_.remove (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_Process_Mutex::acquire (void) -{ - return this->lock_.acquire (); -} - -// Conditionally acquire lock (i.e., don't wait on queue). -ACE_INLINE int -ACE_Process_Mutex::tryacquire (void) -{ - return this->lock_.tryacquire (); -} - -// Release lock and unblock a thread at head of priority queue. -ACE_INLINE int -ACE_Process_Mutex::release (void) -{ - return this->lock_.release (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_Process_Mutex::acquire_read (void) -{ - return this->lock_.acquire_read (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_Process_Mutex::acquire_write (void) -{ - return this->lock_.acquire_write (); -} - -// Conditionally acquire a lock (i.e., won't block). -ACE_INLINE int -ACE_Process_Mutex::tryacquire_read (void) -{ - return this->lock_.tryacquire_read (); -} - -// Conditionally acquire a lock (i.e., won't block). -ACE_INLINE int -ACE_Process_Mutex::tryacquire_write (void) -{ - return this->lock_.tryacquire_write (); -} - -ACE_INLINE int -ACE_Process_Mutex::tryacquire_write_upgrade (void) -{ - return 0; -} - -// Explicitly destroy the mutex. -ACE_INLINE int -ACE_RW_Process_Mutex::remove (void) -{ - return this->lock_.remove (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_RW_Process_Mutex::acquire (void) -{ - return this->lock_.acquire (); -} - -// Conditionally acquire lock (i.e., don't wait on queue). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire (void) -{ - return this->lock_.tryacquire (); -} - -// Release lock and unblock a thread at head of priority queue. -ACE_INLINE int -ACE_RW_Process_Mutex::release (void) -{ - return this->lock_.release (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_RW_Process_Mutex::acquire_read (void) -{ - return this->lock_.acquire_read (); -} - -// Acquire lock ownership (wait on priority queue if necessary). -ACE_INLINE int -ACE_RW_Process_Mutex::acquire_write (void) -{ - return this->lock_.acquire_write (); -} - -// Conditionally acquire a lock (i.e., won't block). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire_read (void) -{ - return this->lock_.tryacquire_read (); -} - -// Conditionally acquire a lock (i.e., won't block). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire_write (void) -{ - return this->lock_.tryacquire_write (); -} - -// Conditionally upgrade a lock (i.e., won't block). -ACE_INLINE int -ACE_RW_Process_Mutex::tryacquire_write_upgrade (void) -{ - return this->lock_.tryacquire_write_upgrade (); -} - -ACE_INLINE const ACE_File_Lock & -ACE_RW_Process_Mutex::lock (void) const -{ -// ACE_TRACE ("ACE_RW_Process_Mutex::lock"); - return this->lock_; -} - ACE_INLINE ACE_Null_Barrier::ACE_Null_Barrier (u_int, const char *, diff --git a/ace/Synch_T.h b/ace/Synch_T.h index 89fda969e8f..4b843aab377 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -865,6 +865,8 @@ public: #if defined (ACE_HAS_THREADS) +class ACE_Process_Mutex; + class ACE_Export ACE_MT_SYNCH { // = TITLE diff --git a/ace/Thread_Exit.cpp b/ace/Thread_Exit.cpp index bff293d67fa..35cda0d2b99 100644 --- a/ace/Thread_Exit.cpp +++ b/ace/Thread_Exit.cpp @@ -104,3 +104,15 @@ ACE_Thread_Exit::~ACE_Thread_Exit (void) { ACE_OS_TRACE ("ACE_Thread_Exit::~ACE_Thread_Exit"); } + +#if (defined (ACE_HAS_THREADS) && \ + (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ + defined (ACE_HAS_TSS_EMULATION))) + +# if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class ACE_TSS<ACE_Thread_Exit>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_TSS<ACE_Thread_Exit> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index 2d749fa32bf..4e97b5967ea 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -2225,11 +2225,6 @@ ACE_Thread_Manager::get_grp (ACE_Task_Base *task, int &grp_id) template class ACE_Unbounded_Queue_Iterator<ACE_Thread_Descriptor*>; template class ACE_Free_List<ACE_Thread_Descriptor>; template class ACE_Locked_Free_List<ACE_Thread_Descriptor, ACE_DEFAULT_THREAD_MANAGER_LOCK>; -# if (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) - // These don't necessarily belong here, but it's a convenient place for them. - template class ACE_TSS<ACE_Dynamic>; - template class ACE_TSS<ACE_Thread_Exit>; -# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) # if defined (ACE_THREAD_MANAGER_LACKS_STATICS) #pragma instantiate ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX> @@ -2247,9 +2242,4 @@ ACE_Thread_Manager::get_grp (ACE_Task_Base *task, int &grp_id) #pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_Thread_Descriptor*> #pragma instantiate ACE_Free_List<ACE_Thread_Descriptor> #pragma instantiate ACE_Locked_Free_List<ACE_Thread_Descriptor, ACE_DEFAULT_THREAD_MANAGER_LOCK> -# if (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) - // These don't necessarily belong here, but it's a convenient place for them. - #pragma instantiate ACE_TSS<ACE_Dynamic> - #pragma instantiate ACE_TSS<ACE_Thread_Exit> -# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/ace-dll.icc b/ace/ace-dll.icc index 526c50e1d0c..8cd96fb8d79 100644 --- a/ace/ace-dll.icc +++ b/ace/ace-dll.icc @@ -241,6 +241,10 @@ option 'SV_Semaphore_Simple.h', 'SV_Shared_Memory.h', 'Synch.h', + 'Process_Semaphore.h', + 'Process_Mutex.h', + 'RW_Process_Mutex.h', + 'File_Lock.h', 'Synch_Options.h', 'Synch_T.h', 'System_Time.h', @@ -419,6 +423,10 @@ option source type(cpp) "Svc_Conf_l.cpp" source type(cpp) "Svc_Conf_y.cpp" source type(cpp) "Synch.cpp" + source type(cpp) "Process_Semaphore.cpp" + source type(cpp) "Process_Mutex.cpp" + source type(cpp) "RW_Process_Mutex.cpp" + source type(cpp) "File_Lock.cpp" source type(cpp) "Synch_Options.cpp" source type(cpp) "System_Time.cpp" source type(cpp) "Task.cpp" diff --git a/ace/ace-lib.icc b/ace/ace-lib.icc index 6f564482c70..82b266067e0 100644 --- a/ace/ace-lib.icc +++ b/ace/ace-lib.icc @@ -155,6 +155,10 @@ option source type(cpp) "Svc_Conf_y.cpp" source type(cpp) "Svc_Handler.cpp" source type(cpp) "Synch.cpp" + source type(cpp) "Process_Semaphore.cpp" + source type(cpp) "Process_Mutex.cpp" + source type(cpp) "RW_Process_Mutex.cpp" + source type(cpp) "File_Lock.cpp" source type(cpp) "Synch_Options.cpp" source type(cpp) "System_Time.cpp" source type(cpp) "Task.cpp" diff --git a/examples/Shared_Malloc/Malloc.cpp b/examples/Shared_Malloc/Malloc.cpp index 89542569147..abd75418662 100644 --- a/examples/Shared_Malloc/Malloc.cpp +++ b/examples/Shared_Malloc/Malloc.cpp @@ -2,6 +2,7 @@ #include "Options.h" #include "Malloc.h" +#include "ace/Process_Mutex.h" ACE_RCSID(Shared_Malloc, Malloc, "$Id$") diff --git a/examples/Shared_Malloc/test_multiple_mallocs.cpp b/examples/Shared_Malloc/test_multiple_mallocs.cpp index 722ad276fd1..5a41c9a4d35 100644 --- a/examples/Shared_Malloc/test_multiple_mallocs.cpp +++ b/examples/Shared_Malloc/test_multiple_mallocs.cpp @@ -6,6 +6,7 @@ #include "ace/Malloc.h" #include "ace/Synch.h" #include "ace/Auto_Ptr.h" +#include "ace/Process_Mutex.h" ACE_RCSID(Shared_Malloc, test_multiple_mallocs, "$Id$") diff --git a/examples/Shared_Malloc/test_position_independent_malloc.cpp b/examples/Shared_Malloc/test_position_independent_malloc.cpp index 3eb5934c5ef..3c466b27fd9 100644 --- a/examples/Shared_Malloc/test_position_independent_malloc.cpp +++ b/examples/Shared_Malloc/test_position_independent_malloc.cpp @@ -10,6 +10,7 @@ #include "ace/Get_Opt.h" #include "ace/Synch.h" #include "ace/Auto_Ptr.h" +#include "ace/Process_Mutex.h" #include "test_position_independent_malloc.h" ACE_RCSID(Shared_Malloc, test_multiple_mallocs, "$Id$") diff --git a/examples/Threads/process_mutex.cpp b/examples/Threads/process_mutex.cpp index 01462c97a01..a8a2f27c5c6 100644 --- a/examples/Threads/process_mutex.cpp +++ b/examples/Threads/process_mutex.cpp @@ -6,6 +6,7 @@ #include "ace/Synch.h" #include "ace/Signal.h" #include "ace/Log_Msg.h" +#include "ace/Process_Mutex.h" ACE_RCSID(Threads, process_mutex, "$Id$") @@ -13,7 +14,7 @@ ACE_RCSID(Threads, process_mutex, "$Id$") static sig_atomic_t done; -extern "C" void +extern "C" void handler (int) { done = 1; @@ -35,26 +36,26 @@ main (int argc, char *argv[]) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquiring\n")); if (pm.acquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "acquire failed")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "acquire failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquired\n")); + 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")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); if (pm.tryacquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "tryacquire failed")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "tryacquire failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = tryacquire\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = tryacquire\n")); if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); } if (argc > 2) @@ -62,11 +63,11 @@ main (int argc, char *argv[]) return 0; } #else -int +int main (int, char *[]) { - ACE_ERROR_RETURN ((LM_ERROR, - "ACE doesn't support support threads on this platform (yet)\n"), - -1); + ACE_ERROR_RETURN ((LM_ERROR, + "ACE doesn't support support threads on this platform (yet)\n"), + -1); } #endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/process_semaphore.cpp b/examples/Threads/process_semaphore.cpp index 5b291f293c0..6a175175477 100644 --- a/examples/Threads/process_semaphore.cpp +++ b/examples/Threads/process_semaphore.cpp @@ -6,6 +6,7 @@ #include "ace/Synch.h" #include "ace/Signal.h" #include "ace/Log_Msg.h" +#include "ace/Process_Semaphore.h" ACE_RCSID(Threads, process_semaphore, "$Id$") @@ -32,30 +33,29 @@ main (int argc, char *argv[]) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquiring\n")); if (pm.acquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "acquire failed")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "acquire failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquired\n")); + 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")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); if (pm.tryacquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "tryacquire failed")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "tryacquire failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = tryacquire\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = tryacquire\n")); if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); } if (argc > 2) pm.remove (); return 0; } - diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp index 36298bd161d..12cfcab0eea 100644 --- a/tests/Conn_Test.cpp +++ b/tests/Conn_Test.cpp @@ -17,8 +17,8 @@ // cache connections on the client. // // = AUTHOR -// Douglas C. Schmidt <schmidt@cs.wustl.edu>, -// Chris Cleeland <cleeland@cs.wustl.edu>, +// Douglas C. Schmidt <schmidt@cs.wustl.edu>, +// Chris Cleeland <cleeland@cs.wustl.edu>, // and Irfan Pyarali <irfan@cs.wustl.edu> // // ============================================================================ @@ -32,6 +32,7 @@ #include "ace/Strategies.h" #include "ace/Auto_Ptr.h" #include "ace/Get_Opt.h" +#include "ace/Process_Mutex.h" #include "Conn_Test.h" ACE_RCSID(tests, Conn_Test, "$Id$") diff --git a/tests/MM_Shared_Memory_Test.cpp b/tests/MM_Shared_Memory_Test.cpp index 6c124d1275d..ff7d4cb983a 100644 --- a/tests/MM_Shared_Memory_Test.cpp +++ b/tests/MM_Shared_Memory_Test.cpp @@ -16,7 +16,7 @@ // far as command line arguments are concerned. // // = AUTHOR -// Prashant Jain <pjain@cs.wustl.edu> +// Prashant Jain <pjain@cs.wustl.edu> // and Douglas C. Schmidt <schmidt@cs.wustl.edu> // // ============================================================================ @@ -24,6 +24,8 @@ #include "test_config.h" #include "ace/Shared_Memory_MM.h" #include "ace/Synch.h" +#include "ace/SV_Semaphore_Simple.h" +#include "ace/Process_Semaphore.h" #include "ace/Thread_Manager.h" ACE_RCSID(tests, MM_Shared_Memory_Test, "$Id$") @@ -48,7 +50,7 @@ public: {} }; #else -typedef ACE_Process_Semaphore SYNCHRONIZER; +typedef ACE_Process_Semaphore SYNCHRONIZER; #endif /* !defined (ACE_LACKS_FORK) */ // Synchronize the start of the parent and the child. @@ -186,16 +188,16 @@ main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("MM_Shared_Memory_Test")); - ACE_TCHAR temp_file[MAXPATHLEN + 1]; + ACE_TCHAR temp_file[MAXPATHLEN + 1]; - // Get the temporary directory, + // Get the temporary directory, // The - 24 is for the filename, mm_shared_mem_testXXXXXX if (ACE::get_temp_dir (temp_file, MAXPATHLEN - 24) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Temporary path too long\n")), -1); // Add the filename to the end ACE_OS::strcat (temp_file, ACE_TEXT ("mm_shared_mem_testXXXXXX")); - + // Store in the global variable. shm_key = temp_file; diff --git a/tests/Malloc_Test.cpp b/tests/Malloc_Test.cpp index 7e40bfcd22a..715fa7d8466 100644 --- a/tests/Malloc_Test.cpp +++ b/tests/Malloc_Test.cpp @@ -21,6 +21,7 @@ #include "ace/Malloc.h" #include "ace/Process.h" #include "ace/Auto_Ptr.h" +#include "ace/Process_Mutex.h" #include "Malloc_Test.h" ACE_RCSID(tests, Malloc_Test, "Malloc_Test.cpp,v 4.22 1999/12/13 22:24:42 nanbor Exp") diff --git a/tests/Process_Mutex_Test.cpp b/tests/Process_Mutex_Test.cpp index 39bd8c2de88..c5e230c416a 100644 --- a/tests/Process_Mutex_Test.cpp +++ b/tests/Process_Mutex_Test.cpp @@ -19,6 +19,7 @@ #include "test_config.h" #include "ace/Synch.h" #include "ace/Process.h" +#include "ace/Process_Mutex.h" #include "ace/Get_Opt.h" ACE_RCSID(tests, Process_Mutex_Test, "$Id$") diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp index 35150a68301..361678b51dd 100644 --- a/tests/Process_Strategy_Test.cpp +++ b/tests/Process_Strategy_Test.cpp @@ -32,7 +32,7 @@ // % Process_Strategy_Test -c PROCESS // // = AUTHOR -// Douglas C. Schmidt <schmidt@cs.wustl.edu> +// Douglas C. Schmidt <schmidt@cs.wustl.edu> // and Kevin Boyle <kboyle@sanwafp.com> // // ============================================================================ @@ -45,6 +45,7 @@ #include "ace/SOCK_Connector.h" #include "ace/Strategies_T.h" #include "ace/Singleton.h" +#include "ace/File_Lock.h" // Counting_Service and Options in here #include "Process_Strategy_Test.h" @@ -170,7 +171,7 @@ Options::filename (void) } Options::Options (void) - : + : // Choose to use processes by default. #if !defined (ACE_LACKS_FORK) concurrency_type_ (PROCESS) @@ -195,12 +196,12 @@ Options::parse_args (int argc, ACE_TCHAR *argv[]) // - 26 is for the "process_strategy_test_temp" that is appended if (ACE::get_temp_dir (this->filename_, MAXPATHLEN - 26) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Temporary path too long\n")), + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Temporary path too long\n")), -1); ACE_OS::strcat (this->filename_, ACE_TEXT ("process_strategy_test_temp")); - + for (int c; (c = get_opt ()) != -1; ) switch (c) { @@ -592,7 +593,7 @@ client (void *arg) // the call to ACE_OS::strrchr (). buf [bytes_read] = '\0'; - size_t count = ACE_OS::atoi (ACE_OS::strrchr (ACE_TEXT_CHAR_TO_TCHAR (buf), + size_t count = ACE_OS::atoi (ACE_OS::strrchr (ACE_TEXT_CHAR_TO_TCHAR (buf), ACE_TEXT (' '))); ACE_DEBUG ((LM_DEBUG, |