2 #include "ace/Thread.h"
3 #include "ace/Log_Category.h"
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 #if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)))
9 template <class TYPE> ACE_INLINE
10 ACE_TSS<TYPE>::ACE_TSS (TYPE *type)
15 template <class TYPE> ACE_INLINE int
16 ACE_TSS<TYPE>::ts_init ()
21 template <class TYPE> ACE_INLINE TYPE *
22 ACE_TSS<TYPE>::ts_object () const
27 template <class TYPE> ACE_INLINE TYPE *
28 ACE_TSS<TYPE>::ts_object (TYPE *type)
34 template <class TYPE> ACE_INLINE TYPE *
35 ACE_TSS<TYPE>::ts_get () const
42 # if defined (ACE_HAS_THR_C_DEST)
43 template <class TYPE> ACE_INLINE ACE_TSS_Adapter *
44 ACE_TSS<TYPE>::ts_value () const
46 // Get the tss adapter from thread-specific storage
48 if (ACE_Thread::getspecific (this->key_, &temp) == -1)
50 return 0; // This should not happen!
52 return static_cast <ACE_TSS_Adapter *> (temp);
55 template <class TYPE> ACE_INLINE TYPE *
56 ACE_TSS<TYPE>::ts_value () const
59 if (ACE_Thread::getspecific (this->key_, &temp) == -1)
61 return 0; // This should not happen!
63 return static_cast <TYPE *> (temp);
65 # endif /* ACE_HAS_THR_C_DEST */
67 # if defined (ACE_HAS_THR_C_DEST)
68 template <class TYPE> ACE_INLINE int
69 ACE_TSS<TYPE>::ts_value (ACE_TSS_Adapter *new_tss_adapter) const
71 if (ACE_Thread::setspecific (this->key_,
72 (void *) new_tss_adapter) != 0)
74 ACELIB_ERROR ((LM_ERROR,
76 ACE_TEXT ("Error: ACE_Thread::setspecific() failed!")));
83 template <class TYPE> ACE_INLINE int
84 ACE_TSS<TYPE>::ts_value (TYPE *new_ts_obj) const
86 if (ACE_Thread::setspecific (this->key_, (void *) new_ts_obj) != 0)
88 ACELIB_ERROR ((LM_ERROR,
90 ACE_TEXT ("Error: ACE_Thread::setspecific() failed!")));
96 # endif /* ACE_HAS_THR_C_DEST */
98 #endif /* ! (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */
100 ACE_END_VERSIONED_NAMESPACE_DECL