diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-04-14 11:10:59 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-04-14 11:10:59 +0000 |
commit | 17e542b974df05e66c453b082675ff4e1d23ace7 (patch) | |
tree | 54380e589c5c0d9bcc4dfa613dfd999b1f45d320 /ACE/ace/Service_Config.cpp | |
parent | a54cd11536debe56b78327a838c607f975a7db32 (diff) | |
download | ATCD-17e542b974df05e66c453b082675ff4e1d23ace7.tar.gz |
Mon Apr 14 11:08:57 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ACE/ace/Service_Config.cpp')
-rw-r--r-- | ACE/ace/Service_Config.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/ACE/ace/Service_Config.cpp b/ACE/ace/Service_Config.cpp index ddc14dc6e4d..c4bd580b70a 100644 --- a/ACE/ace/Service_Config.cpp +++ b/ACE/ace/Service_Config.cpp @@ -30,6 +30,67 @@ ACE_RCSID (ace, ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_Threading_Helper<ACE_Thread_Mutex>::~ACE_Threading_Helper () +{ + ACE_OS::thr_key_detach (this->key_, 0); + ACE_OS::thr_keyfree (this->key_); +} + +ACE_Threading_Helper<ACE_Thread_Mutex>::ACE_Threading_Helper () + : key_ (ACE_OS::NULL_key) +{ +# if defined (ACE_HAS_TSS_EMULATION) + ACE_Object_Manager::init_tss (); +# endif + + if (ACE_Thread::keycreate (&key_, 0, 0) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Failed to create thread key: %p\n"), + "")); + } +} + +void +ACE_Threading_Helper<ACE_Thread_Mutex>::set (void* p) +{ + if (ACE_Thread::setspecific (key_, p) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Service Config failed to set thread key value: %p\n"), + "")); +} + +void* +ACE_Threading_Helper<ACE_Thread_Mutex>::get (void) +{ + void* temp = 0; + if (ACE_Thread::getspecific (key_, &temp) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Service Config failed to get thread key value: %p\n"), + ""), + 0); + return temp; +} + +ACE_Threading_Helper<ACE_Null_Mutex>::~ACE_Threading_Helper () +{ +} + +ACE_Threading_Helper<ACE_Null_Mutex>::ACE_Threading_Helper () +{ +} + +void +ACE_Threading_Helper<ACE_Null_Mutex>::set (void*) +{ +} + +void* +ACE_Threading_Helper<ACE_Null_Mutex>::get (void) +{ + return ACE_Service_Config::singleton()->instance_.get (); +} + /** * @c ACE_Service_Config is supposed to be a Singleton. This is the * only Configuration Gestalt available for access from static |