template <class TYPE, class FUNCTOR, class ACE_LOCK> int ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, const void **act, int dont_call) { ACE_TRACE ("ACE_Timer_List_T::cancel"); ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); // Make sure we are getting a valid <timer_id>, not an error // returned by schedule () if (timer_id == -1) return 0; ACE_Timer_Node_T<TYPE> *node = ACE_reinterpret_cast (ACE_Timer_Node_T<TYPE> *, timer_id); // Check to see if the node looks like a true ACE_Timer_Node_T<TYPE> if (timer_id == node->get_timer_id ()) { node->get_next ()->set_prev (node->get_prev ()); node->get_prev ()->set_next (node->get_next ()); if (act != 0) *act = node->get_act (); if (dont_call == 0) this->upcall_functor ().cancellation (*this, node->get_type ()); this->free_node (node); return 1; } // Wasn't valid return 0; }
void * ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors) { ACE_TRACE ("ACE_DLL_Handle::symbol"); ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); ACE_Auto_Array_Ptr <ACE_TCHAR> auto_name (ACE::ldname (sym_name)); // handle_ can be invalid especially when ACE_DLL_Handle resigned ownership // BTW. Handle lifecycle management is a little crazy in ACE if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) { #if defined (ACE_OPENVMS) void *sym = ACE::ldsymbol (this->handle_, auto_name.get ()); #else void *sym = ACE_OS::dlsym (this->handle_, auto_name.get ()); #endif // Linux says that the symbol could be null and that it isn't an // error. So you should check the error message also, but since // null symbols won't do us much good anyway, let's still report // an error. if (!sym && ignore_errors != 1) { if (ACE::debug ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE (%P|%t) DLL_Handle::symbol (\"%s\") ") ACE_TEXT (" failed with \"%s\".\n"), auto_name.get (), this->error ()->c_str ())); return 0; } return sym; } return 0; }
ACE_UINT32 ACE_High_Res_Timer::global_scale_factor (void) { #if (defined (ACE_WIN32) || defined (ACE_HAS_POWERPC_TIMER) || \ defined (ACE_HAS_PENTIUM) || defined (ACE_HAS_ALPHA_TIMER)) && \ !defined (ACE_HAS_HI_RES_TIMER) && \ ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || \ defined (ghs) || defined (__GNUG__) || defined (__KCC)) // Check if the global scale factor needs to be set, and do if so. if (ACE_High_Res_Timer::global_scale_factor_status_ == 0) { // Grab ACE's static object lock. This doesn't have anything to // do with static objects; it's just a convenient lock to use. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); // Double check if (ACE_High_Res_Timer::global_scale_factor_status_ == 0) { # if defined (ACE_WIN32) LARGE_INTEGER freq; if (::QueryPerformanceFrequency (&freq)) { // We have a high-res timer # if defined (ghs) ACE_UINT64 uint64_freq(freq.u.LowPart, (ACE_UINT32) freq.u.HighPart); ACE_High_Res_Timer::global_scale_factor (uint64_freq / (ACE_UINT32) ACE_ONE_SECOND_IN_USECS); # else ACE_High_Res_Timer::global_scale_factor (ACE_static_cast (unsigned int, freq.QuadPart / ACE_HR_SCALE_CONVERSION)); # endif // (ghs) ACE_High_Res_Timer::global_scale_factor_status_ = 1; }
template <PR_ST_1, ACE_SYNCH_DECL> int ACE_Buffered_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->msg_queue ()->lock (), -1); // Enqueue <mb> onto the message queue. if (this->putq (mb, tv) == -1) return -1; else { // Update the current number of bytes on the queue. this->current_buffer_size_ += mb->total_size (); // Flush the buffer when the number of bytes exceeds the maximum // buffer size or when the timeout period has elapsed. if (this->current_buffer_size_ >= this->maximum_buffer_size_ || (this->timeoutp_ != 0 && this->next_timeout_ <= ACE_OS::gettimeofday ())) return this->flush_i (); else return 0; } }
Monitor_Control_Types::NameList Monitor_Base::get_list (void) const { Monitor_Control_Types::NameList retval; if(this->data_.type_ != Monitor_Control_Types::MC_LIST) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("get_list: %s is not a ") ACE_TEXT ("list monitor type\n"), this->name_.c_str ())); return retval; } ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, retval); for(size_t i = 0UL; i < this->data_.index_; ++i) { retval.push_back (this->data_.list_[i]); } return retval; }
BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battleground* bg) { // load/create a map ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL); sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId()); PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(),bg->GetMinLevel()); uint8 spawnMode; if (bracketEntry) spawnMode = bracketEntry->difficulty; else spawnMode = REGULAR_DIFFICULTY; BattlegroundMap *map = new BattlegroundMap(GetId(), GetGridExpiry(), InstanceId, this, spawnMode); ASSERT(map->IsBattlegroundOrArena()); map->SetBG(bg); bg->SetBgMap(map); m_InstancedMaps[InstanceId] = map; return map; }
ssize_t ACE_MT_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf, int flags, const ACE_Time_Value *timeout) { ACE_TRACE ("ACE_MT_MEM_IO::recv_buf"); // @@ Don't know how to handle timeout yet. ACE_UNUSED_ARG (timeout); ACE_UNUSED_ARG (flags); if (this->shm_malloc_ == 0) { return -1; } // Need to handle timeout here. if (this->recv_channel_.sema_->acquire () == -1) { return -1; } { // @@ We can probably skip the lock in certain circumstance. ACE_GUARD_RETURN (ACE_SYNCH_PROCESS_MUTEX, ace_mon, *this->recv_channel_.lock_, -1); buf = this->recv_channel_.queue_.read (); if (buf != 0) { return ACE_Utils::truncate_cast<ssize_t> (buf->size ()); } return -1; } }
ACE_Framework_Repository * ACE_Framework_Repository::instance (int size) { ACE_TRACE ("ACE_Framework_Repository::instance"); if (ACE_Framework_Repository::repository_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); if (ACE_Framework_Repository::repository_ == 0) { if (ACE_Object_Manager::starting_up () || !ACE_Object_Manager::shutting_down ()) { ACE_NEW_RETURN (ACE_Framework_Repository::repository_, ACE_Framework_Repository (size), 0); } } } return ACE_Framework_Repository::repository_; }
bool Random_File::open(const ACE_TCHAR* filename, size_t block_size) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, false); this->block_size_ = block_size; bool result = (this->close() == 0); if (result) { if (DEBUG_LEVEL > 8) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Opening file %s\n") , filename )); ACE_HANDLE handle = ACE_OS::open(filename, O_CREAT | O_RDWR | O_BINARY, ACE_DEFAULT_FILE_PERMS); if (handle == ACE_INVALID_HANDLE) { result = false; } else { this->set_handle(handle); if (this->get_handle() == 0) { result = false; } else { result = (this->addr_.set(filename) == 0); } } } return result; }
const ACE_INET_Addr & TAO_SSLIOP_Endpoint::object_addr (void) const { // The object_addr_ is initialized here, rather than at IOR decode // time for several reasons: // 1. A request on the object may never be invoked. // 2. The DNS setup may have changed dynamically. // ...etc.. // Double checked locking optimization. if (this->object_addr_.get_type () != AF_INET #if defined (ACE_HAS_IPV6) && this->object_addr_.get_type () != AF_INET6 #endif /* ACE_HAS_IPV6 */ ) { const ACE_INET_Addr &iiop_addr = this->iiop_endpoint_->object_addr (); ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->addr_lookup_lock_, this->object_addr_); if (this->object_addr_.get_type () != AF_INET #if defined (ACE_HAS_IPV6) && this->object_addr_.get_type () != AF_INET6 #endif /* ACE_HAS_IPV6 */ ) { this->object_addr_ = iiop_addr; this->object_addr_.set_port_number (this->ssl_component_.port); } } return this->object_addr_; }
Sender * Connection_Cache::acquire_connection (void) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0); // Find a valid and IDLE sender. int index = -1; for (int i = 0; i < number_of_connections; ++i) { if (this->entries_[i].sender_ && this->entries_[i].state_ == IDLE) index = i; } if (index == -1) return 0; this->entries_[index].sender_->add_reference (); this->entries_[index].state_ = BUSY; return this->entries_[index].sender_; }
CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_Notify_EventChannel::default_supplier_admin (void) { if (CORBA::is_nil (default_supplier_admin_.in ())) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->default_admin_mutex_, CosNotifyChannelAdmin::SupplierAdmin::_nil()); if (CORBA::is_nil (default_supplier_admin_.in ())) { CosNotifyChannelAdmin::AdminID id; this->default_supplier_admin_ = this->new_for_suppliers (TAO_Notify_PROPERTIES::instance ()->defaultSupplierAdminFilterOp(), id); PortableServer::ServantBase * admin_servant = this->poa()->poa()->reference_to_servant ( this->default_supplier_admin_.in ()); TAO_Notify_Admin * pAdmin = dynamic_cast <TAO_Notify_Admin *> (admin_servant); ACE_ASSERT (pAdmin != 0); // if this assert triggers, we have mixed implementations? if (pAdmin != 0) { pAdmin->set_default (true); } } } return CosNotifyChannelAdmin::SupplierAdmin::_duplicate (this->default_supplier_admin_.in ()); }
int ACE_Based_Pointer_Repository::find (void *addr, void *&base_addr) { ACE_TRACE ("ACE_Based_Pointer_Repository::find"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0; for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_); iter.next (ce) != 0; iter.advance ()) // Check to see if <addr> is within any of the regions. if (addr >= ce->ext_id_ && addr < ((char *) ce->ext_id_ + ce->int_id_)) { // Assign the base address. base_addr = ce->ext_id_; return 1; } // Assume base address 0 (e.g., if new'ed). base_addr = 0; return 0; }
long TRB_Proactor::schedule_timer (TRB_Handler &handler, const void *act, const ACE_Time_Value &time, const ACE_Time_Value &interval) { // absolute time. ACE_Time_Value absolute_time = this->timer_queue_->gettimeofday () + time; // Only one guy goes in here at a time ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, this->timer_queue_->mutex (), -1)); // Schedule the timer long result = this->timer_queue_->schedule (&handler, act, absolute_time, interval); if (result != -1) { // no failures: check to see if we are the earliest time if (this->timer_queue_->earliest_time () == absolute_time) // wake up the timer thread if (this->timer_handler_->timer_event_.signal () == -1) { // Cancel timer this->timer_queue_->cancel (result); result = -1; } } return result; }
int TAO_Table_Adapter::dispatch (TAO::ObjectKey &key, TAO_ServerRequest &request, CORBA::Object_out forward_to) { TAO_IOR_Table_Impl_var rootref; { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, TAO_Adapter::DS_MISMATCHED_KEY); if (this->closed_) return TAO_Adapter::DS_MISMATCHED_KEY; rootref = this->root_; } if (this->find_object (key, forward_to)) { request.forward_location (forward_to); return TAO_Adapter::DS_FORWARD; } else return TAO_Adapter::DS_MISMATCHED_KEY; }
int GDCT_Transfer::do_send_one_data(GDCT_Data *the_data) { int ret; ACE_Time_Value to = default_timeout_; unsigned char *buf = (unsigned char*) the_data->msg_->rd_ptr(); size_t buflen = the_data->msg_->length(); ret = KSGNetUtil::send_buffer(connector_.get_handle(),buf,buflen,&to); if(ret) { int r = ACE_OS::last_error(); ACE_DEBUG((LM_ERROR,"发送数据到讯源错误,error[%d:%s]",r,ACE_OS::strerror(r))); the_data->msg_->release(); REACTOR_SCHEDULER::instance()->close_error_socket(the_data->handle_); return -1; } { // 保存到等待接收队列 char seqno[11] = ""; memcpy(seqno,the_data->msg_->rd_ptr()+4,10); ACE_GUARD_RETURN(ACE_Thread_Mutex,m,msg_mutex_,-1); output_queue_.insert(MESSAGE_MAP_TYPE::value_type(seqno,*the_data)); } return 0; }
PortableGroup::ObjectGroup_ptr TAO_PG_ObjectGroupManager::add_member ( PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location, CORBA::Object_ptr member) { if (CORBA::is_nil (member)) throw CORBA::BAD_PARAM (); ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->lock_, PortableGroup::ObjectGroup::_nil ()); // Verify that the member's RepositoryId matches the object group's // type ID. const CORBA::Boolean check_type_id = 1; return this->add_member_i (object_group, the_location, member, check_type_id); }
template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Time_Value * ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, max_wait_time)); if (this->is_empty ()) // Nothing on the Timer_Queue, so use whatever the caller gave us. return max_wait_time; else { ACE_Time_Value cur_time = this->gettimeofday (); if (this->earliest_time () > cur_time) { // The earliest item on the Timer_Queue is still in the // future. Therefore, use the smaller of (1) caller's wait // time or (2) the delta time between now and the earliest // time on the Timer_Queue. this->timeout_ = this->earliest_time () - cur_time; if (max_wait_time == 0 || *max_wait_time > timeout_) return &this->timeout_; else return max_wait_time; } else { // The earliest item on the Timer_Queue is now in the past. // Therefore, we've got to "poll" the Reactor, i.e., it must // just check the descriptors and then dispatch timers, etc. this->timeout_ = ACE_Time_Value::zero; return &this->timeout_; } } }
ACE_Proactor * ACE_Proactor::instance (size_t /* threads */) { ACE_TRACE ("ACE_Proactor::instance"); if (ACE_Proactor::proactor_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); if (ACE_Proactor::proactor_ == 0) { ACE_NEW_RETURN (ACE_Proactor::proactor_, ACE_Proactor, 0); ACE_Proactor::delete_proactor_ = true; ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_); } } return ACE_Proactor::proactor_; }
bool MgServerFeatureReaderPool::Remove(STRING featureReader) { ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, false)); bool bResult = false; INT32 ref = 0; FeatureReaderCollection::iterator iterator = m_frCollection.find(featureReader); if(m_frCollection.end() != iterator) { // Release resources MgFeatureReader* reader = iterator->second; if(reader) { ref = reader->Release(); } // Remove the reader m_frCollection.erase(iterator); bResult = true; } return bResult; }
int Client_Task::svc (void) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting client task\n")); try { while (1) { // run the even loop for 1 second... ACE_Time_Value tv (1, 0); this->orb_->run (tv); ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, -1); if (this->terminate_loop_ != 0) break; } } catch (const CORBA::Exception&) { return -1; } ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client task finished\n")); return 0; }
int ACE_Message_Queue_NT::pulse (void) { ACE_TRACE ("ACE_Message_Queue_NT::pulse"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); int const previous_state = this->state_; if (previous_state != ACE_Message_Queue_Base::DEACTIVATED) { this->state_ = ACE_Message_Queue_Base::PULSED; // Get the number of shutdown messages necessary to wake up all // waiting threads. DWORD cntr = this->cur_thrs_ - static_cast<DWORD> (this->cur_count_); while (cntr-- > 0) ::PostQueuedCompletionStatus (this->completion_port_, 0, this->state_, 0); } return previous_state; }
int Sched_Ready_Queue<DSRT_Scheduler_Traits, More_Eligible_Comparator, ACE_LOCK>:: remove (Guid_t guid) { ACE_GUARD_RETURN (ACE_LOCK, mon, lock_, -1); RB_Tree_Dispatch_Item_Node* rb_tree_node = 0; if (dispatch_items_hash_map_.find(guid, rb_tree_node) == 0) { dispatch_items_hash_map_.unbind (guid); dispatch_items_prio_queue_.unbind (rb_tree_node); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "<===Hash Table contents Begin===>\n")); dispatch_items_hash_map_.dump (); ACE_DEBUG ((LM_DEBUG, "<===Hash Table contents End===>\n")); #endif return 0; } return -1; }
template <class T> int ACE_Future_Rep<T>::get (T &value, ACE_Time_Value *tv) const { // If the value is already produced, return it. if (this->value_ == 0) { ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, this->value_ready_mutex_, -1); // If the value is not yet defined we must block until the // producer writes to it. while (this->value_ == 0) // Perform a timed wait. if (this->value_ready_.wait (tv) == -1) return -1; // Destructor releases the lock. } value = *this->value_; return 0; }
int Connector::validate_connection(const TRB_Asynch_Connect::Result& result, const ACE_INET_Addr& /*remote*/, const ACE_INET_Addr& /*local*/) { ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, monitor, this->mutex (), -1); --this->ref_cnt_; int rc = 0; if (!result.success() || this->should_finish()) { rc = -1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Connector: Connect failed err=%d\n"), (int) result.error())); } if(this->is_safe_to_delete()) this->task().signal_main(); return rc; }
RequestEngine<SthenoPacket*>::RequestPtr* LeafClientHandler::sendRequest(SthenoPacket* packet, ACE_Time_Value* timeout) { ACE_GUARD_RETURN(ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, m_lock, 0); if (m_close) { return 0; } ACE_Message_Block* mb = serializePacket(packet); if (m_debugLeafClientHandler) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)INFO: LeafClientHandler:sendRequest(): buffer_size=%d packet_serialize_size=%d\n"), mb->length(), packet->getSerializationSize())); } UInt id = ((SthenoHeader*) (packet->getPacketHeader()))->getPacketID(); RequestEngine<SthenoPacket*>::RequestPtr* request = new RequestEngine<SthenoPacket*>::RequestPtr(new Request<SthenoPacket*>(&m_requests, id, timeout)); m_requests.bind(request); int ret = AbstractStreamChannel<ACE_SOCK_Stream, ACE_MT_SYNCH>::send(mb, timeout); ACE_Message_Block::release(mb); if (ret == -1) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)ERROR: LeafClientHandler:sendRequest() - register ID(%d) failed!"), id)); delete request; return 0; } return request; }
int ETCL_Interpreter::build_tree (const char* constraints) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, ETCL_Interpreter::parserMutex__, -1); Lex_String_Input::reset ((char*)constraints); yyval.constraint = 0; int return_value = ::yyparse (); if (return_value == 0 && yyval.constraint != 0) { this->root_ = yyval.constraint; } else { this->root_ = 0; } return return_value; }
static void * worker (void *c) { intptr_t count = reinterpret_cast<intptr_t> (c); ACE_thread_key_t key = ACE_OS::NULL_key; int *ip = 0; // Make one key that will be available when the thread exits so that // we'll have something to cleanup! if (ACE_Thread::keycreate (&key, cleanup) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::keycreate")); ACE_NEW_RETURN (ip, int, 0); if (ACE_Thread::setspecific (key, (void *) ip) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::setspecific")); for (intptr_t i = 0; i < count; i++) { if (ACE_Thread::keycreate (&key, cleanup) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::keycreate")); ACE_NEW_RETURN (ip, int, 0); ACE_DEBUG ((LM_DEBUG, "(%t) in worker 1, key = %d, ip = %x\n", key, ip)); { // tmp is workaround for gcc strict aliasing warning. void *tmp = reinterpret_cast <void *> (ip); if (ACE_Thread::setspecific (key, tmp) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::setspecific")); if (ACE_Thread::getspecific (key, &tmp) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::setspecific")); if (ACE_Thread::setspecific (key, (void *) 0) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::setspecific")); } delete ip; if (ACE_Thread::keyfree (key) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::keyfree")); // Cause an error. ACE_OS::read (ACE_INVALID_HANDLE, 0, 0); // The following two lines set the thread-specific state. tss_error->error (errno); tss_error->line (__LINE__); // This sets the static state (note how C++ makes it easy to do // both). tss_error->flags (ACE_Utils::truncate_cast<int> (count)); { // Use the guard to serialize access to printf... ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, printf_lock, 0); // Print the thread id portably. ACE_DEBUG ((LM_DEBUG, "(%t) errno = %d, lineno = %d, flags = %d\n", tss_error->error (), tss_error->line (), tss_error->flags ())); } key = ACE_OS::NULL_key; if (ACE_Thread::keycreate (&key, cleanup) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::keycreate")); ACE_NEW_RETURN (ip, int, 0); ACE_DEBUG ((LM_DEBUG, "(%t) in worker 2, key = %d, ip = %x\n", key, ip)); { // Tmp is workaround for GCC strict aliasing warning. void *tmp (reinterpret_cast <void *> (ip)); if (ACE_Thread::setspecific (key, tmp) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::setspecific")); if (ACE_Thread::getspecific (key, &tmp) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::setspecific")); if (ACE_Thread::setspecific (key, (void *) 0) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::setspecific")); } delete ip; if (ACE_Thread::keyfree (key) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_Thread::keyfree")); } ACE_DEBUG ((LM_DEBUG, "(%t) exiting\n")); return 0; }
size_t KSG_Task_Queue::count_of_preemptive_tasks() { ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex,mon,_task_list_mutex,0)); return _list_of_preempt_tasks.size(); }
int Callback_i::done (void) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); return this->remaining_samples_ == 0; }