diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2016-02-12 15:37:31 +0100 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2016-02-12 15:37:31 +0100 |
commit | b61579224c35cbefe2a34a6315bea999cf6ff67e (patch) | |
tree | 18d6fc34d7ab8b27f62c8b3945a97eaad021f42b /ACE/ace/Service_Repository.h | |
parent | ae65ab947f05f6ef56abfbb2fc2fae6f5b19fe2b (diff) | |
download | ATCD-b61579224c35cbefe2a34a6315bea999cf6ff67e.tar.gz |
Added a lock accessor to the ACE Service Repository which is now of
type ACE_SYNCH_RECURSIVE_MUTEX so that user code that iterates the
service repository can lock its content during iteration to make sure
it doesn't get a corrupted state when another thread tries to change
its state
* ACE/ace/Service_Repository.cpp:
* ACE/ace/Service_Repository.h:
* ACE/ace/Service_Repository.inl:
* ACE/tests/Service_Config_Test.cpp:
Diffstat (limited to 'ACE/ace/Service_Repository.h')
-rw-r--r-- | ACE/ace/Service_Repository.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ACE/ace/Service_Repository.h b/ACE/ace/Service_Repository.h index 65e37668449..135d6d52759 100644 --- a/ACE/ace/Service_Repository.h +++ b/ACE/ace/Service_Repository.h @@ -20,9 +20,10 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Default_Constants.h" -#include "ace/Recursive_Thread_Mutex.h" +#include "ace/Synch_Traits.h" #include "ace/Array_Map.h" #include "ace/Malloc_Base.h" +#include "ace/Recursive_Thread_Mutex.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -131,6 +132,9 @@ public: /// Dump the state of an object. void dump (void) const; + /// Returns a reference to the lock used by the ACE_Service_Repository + ACE_SYNCH_RECURSIVE_MUTEX &lock (void); + /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -201,10 +205,8 @@ protected: /// Must delete the @c svc_rep_ if true. static bool delete_svc_rep_; -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) /// Synchronization variable for the MT_SAFE Repository - mutable ACE_Recursive_Thread_Mutex lock_; -#endif /* ACE_MT_SAFE */ + mutable ACE_SYNCH_RECURSIVE_MUTEX lock_; }; /** |