summaryrefslogtreecommitdiff
path: root/ACE/ace/Service_Config.cpp
diff options
context:
space:
mode:
authoriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-04-10 22:47:04 +0000
committeriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-04-10 22:47:04 +0000
commit87debb0a4b21f4346b5c225ac0aa8f61bdb58343 (patch)
treeef6f20b269582932f2b57bb2e08c78bfddf5dcd4 /ACE/ace/Service_Config.cpp
parente40e44fed73d5531b619afc0305a101a1da60a15 (diff)
downloadATCD-87debb0a4b21f4346b5c225ac0aa8f61bdb58343.tar.gz
ChangeLogTag: Thu Apr 10 22:32:58 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com>
Diffstat (limited to 'ACE/ace/Service_Config.cpp')
-rw-r--r--ACE/ace/Service_Config.cpp114
1 files changed, 68 insertions, 46 deletions
diff --git a/ACE/ace/Service_Config.cpp b/ACE/ace/Service_Config.cpp
index e42e12e4b0d..37d8dcf4ffa 100644
--- a/ACE/ace/Service_Config.cpp
+++ b/ACE/ace/Service_Config.cpp
@@ -30,6 +30,74 @@ ACE_RCSID (ace,
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+template <>
+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"),
+ ""));
+ }
+}
+
+template <>
+ACE_Threading_Helper<ACE_Null_Mutex>::ACE_Threading_Helper ()
+ : key_ (ACE_OS::NULL_key)
+{
+}
+
+
+template <>
+ACE_Threading_Helper<ACE_Thread_Mutex>::~ACE_Threading_Helper ()
+{
+ ACE_OS::thr_key_detach (this->key_, 0);
+ ACE_OS::thr_keyfree (this->key_);
+}
+
+template <>
+ACE_Threading_Helper<ACE_Null_Mutex>::~ACE_Threading_Helper ()
+{
+}
+
+template <> 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"),
+ ""));
+}
+
+template <> void
+ACE_Threading_Helper<ACE_Null_Mutex>::set (void*)
+{
+}
+
+template <> 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;
+}
+
+template <> 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
@@ -381,52 +449,6 @@ ACE_Service_Config::ACE_Service_Config (const ACE_TCHAR program_name[],
}
}
-ACE_Threading_Helper::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"),
- ""));
- }
-}
-
-
-ACE_Threading_Helper::~ACE_Threading_Helper ()
-{
-#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))
- ACE_OS::thr_key_detach (this->key_, 0);
- ACE_OS::thr_keyfree (this->key_);
-#else // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))
-
-#endif // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))
-}
-
-void
-ACE_Threading_Helper::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::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;
-}
/// Return the "global" configuration instance, for the current