summaryrefslogtreecommitdiff
path: root/ace/TSS_T.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2006-03-27 03:41:31 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2006-03-27 03:41:31 +0000
commit7be4636d9265b1826f67adf2c6c426b6afb37aa0 (patch)
tree0e2d5683eb907a712d8aa5797699e105df63ed6a /ace/TSS_T.cpp
parent90e9c7b7e6085344382159d3893e6368718466e3 (diff)
downloadATCD-7be4636d9265b1826f67adf2c6c426b6afb37aa0.tar.gz
ChangeLogTag:Sun Mar 26 21:40:10 2006 Douglas C. Schmidt <schmidt@cse.wustl.edu>
Diffstat (limited to 'ace/TSS_T.cpp')
-rw-r--r--ace/TSS_T.cpp160
1 files changed, 96 insertions, 64 deletions
diff --git a/ace/TSS_T.cpp b/ace/TSS_T.cpp
index 93897437e64..d6dc2599e8d 100644
--- a/ace/TSS_T.cpp
+++ b/ace/TSS_T.cpp
@@ -81,7 +81,7 @@ ACE_TSS<TYPE>::dump (void) const
#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))
#if defined (ACE_HAS_THR_C_DEST)
-extern "C" void ACE_TSS_C_cleanup(void *); // defined in Synch.cpp
+extern "C" void ACE_TSS_C_cleanup (void *); // defined in Synch.cpp
#endif /* ACE_HAS_THR_C_DEST */
template <class TYPE> void
@@ -94,7 +94,7 @@ ACE_TSS<TYPE>::cleanup (void *ptr)
template <class TYPE> int
ACE_TSS<TYPE>::ts_init (void) const
{
- // Insure that we are serialized!
+ // Ensure that we are serialized!
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->keylock_, 0);
// Use the Double-Check pattern to make sure we only create the key
@@ -195,18 +195,20 @@ ACE_TSS<TYPE>::ts_get (void) const
ACE_TSS_Adapter *tss_adapter = 0;
// Get the adapter from thread-specific storage
- if (ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter) == -1)
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ if (ACE_Thread::getspecific (this->key_, &temp) == -1)
return 0; // This should not happen!
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
// Check to see if this is the first time in for this thread.
if (tss_adapter == 0)
#else
// Get the ts_obj from thread-specific storage. Note that no locks
// are required here...
- if (ACE_Thread::getspecific (this->key_,
- (void **) &ts_obj) == -1)
+ void *temp = ts_obj; // Need this temp to keep G++ from complaining.
+ if (ACE_Thread::getspecific (this->key_, &temp) == -1)
return 0; // This should not happen!
+ ts_obj = static_cast <TYPE *> (temp);
// Check to see if this is the first time in for this thread.
if (ts_obj == 0)
@@ -249,7 +251,7 @@ ACE_TSS<TYPE>::ts_get (void) const
#if defined (ACE_HAS_THR_C_DEST)
// Return the underlying ts object.
- return (TYPE *) tss_adapter->ts_obj_;
+ return static_cast <TYPE *> (tss_adapter->ts_obj_);
#else
return ts_obj;
#endif /* ACE_HAS_THR_C_DEST */
@@ -274,16 +276,25 @@ ACE_TSS<TYPE>::ts_object (void) const
ACE_TSS_Adapter *tss_adapter = 0;
// Get the tss adapter from thread-specific storage
- if (ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter) == -1)
- return 0; // This should not happen!
- else if (tss_adapter != 0)
- // Extract the real TS object.
- ts_obj = (TYPE *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ if (ACE_Thread::getspecific (this->key_, &temp) == -1)
+ {
+ return 0; // This should not happen!
+ }
+ else
+ {
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ {
+ if (tss_adapter != 0)
+ // Extract the real TS object.
+ ts_obj = static_cast <TYPE *> (tss_adapter->ts_obj_);
+ }
+ }
#else
- if (ACE_Thread::getspecific (this->key_,
- (void **) &ts_obj) == -1)
+ void *temp = ts_obj; // Need this temp to keep G++ from complaining.
+ if (ACE_Thread::getspecific (this->key_, &temp) == -1)
return 0; // This should not happen!
+ ts_obj = static_cast <TYPE *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return ts_obj;
@@ -310,13 +321,14 @@ ACE_TSS<TYPE>::ts_object (TYPE *new_ts_obj)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- if (ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter) == -1)
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ if (ACE_Thread::getspecific (this->key_, &temp) == -1)
return 0; // This should not happen!
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
if (tss_adapter != 0)
{
- ts_obj = (TYPE *) tss_adapter->ts_obj_;
+ ts_obj = static_cast <TYPE *> (tss_adapter->ts_obj_);
delete tss_adapter; // don't need this anymore
}
@@ -332,9 +344,11 @@ ACE_TSS<TYPE>::ts_object (TYPE *new_ts_obj)
return ts_obj; // This should not happen!
}
#else
+ void *temp = ts_obj; // Need this temp to keep G++ from complaining.
if (ACE_Thread::getspecific (this->key_,
- (void **) &ts_obj) == -1)
+ &temp) == -1)
return 0; // This should not happen!
+ ts_obj = static_cast <TYPE *> (temp);
if (ACE_Thread::setspecific (this->key_,
(void *) new_ts_obj) == -1)
return ts_obj; // This should not happen!
@@ -389,12 +403,14 @@ ACE_TSS_Guard<ACE_LOCK>::release (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *)tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->release ();
@@ -409,12 +425,14 @@ ACE_TSS_Guard<ACE_LOCK>::remove (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->remove ();
@@ -429,12 +447,14 @@ ACE_TSS_Guard<ACE_LOCK>::~ACE_TSS_Guard (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
// Make sure that this pointer is NULL when we shut down...
@@ -486,12 +506,14 @@ ACE_TSS_Guard<ACE_LOCK>::acquire (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->acquire ();
@@ -506,12 +528,14 @@ ACE_TSS_Guard<ACE_LOCK>::tryacquire (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->tryacquire ();
@@ -551,12 +575,14 @@ ACE_TSS_Write_Guard<ACE_LOCK>::acquire (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->acquire_write ();
@@ -571,12 +597,14 @@ ACE_TSS_Write_Guard<ACE_LOCK>::tryacquire (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, temp);
+ guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->tryacquire_write ();
@@ -639,12 +667,14 @@ ACE_TSS_Read_Guard<ACE_LOCK>::acquire (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->acquire_read ();
@@ -659,12 +689,14 @@ ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire (void)
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
- ACE_Thread::getspecific (this->key_,
- (void **) &tss_adapter);
- guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_;
+ void *temp = tss_adapter; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ tss_adapter = static_cast <ACE_TSS_Adapter *> (temp);
+ guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_);
#else
- ACE_Thread::getspecific (this->key_,
- (void **) &guard);
+ void *temp = guard; // Need this temp to keep G++ from complaining.
+ ACE_Thread::getspecific (this->key_, &temp);
+ guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (temp);
#endif /* ACE_HAS_THR_C_DEST */
return guard->tryacquire_read ();