示例#1
0
template <class ACE_LOCK> int
ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire (void)
{
// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire");

  ACE_Read_Guard<ACE_LOCK> *guard = 0;

#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_;
#else
  ACE_Thread::getspecific (this->key_,
                           (void **) &guard);
#endif /* ACE_HAS_THR_C_DEST */

  return guard->tryacquire_read ();
}
示例#2
0
文件: TSS_T.cpp 项目: 1ATOM/mangos
template <class ACE_LOCK> int
ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire (void)
{
// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire");

  ACE_Read_Guard<ACE_LOCK> *guard = 0;

#if defined (ACE_HAS_THR_C_DEST)
  ACE_TSS_Adapter *tss_adapter = 0;
  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
  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 ();
}