00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "EntryExit.h" 00009 #include "ace/ACE.h" 00010 00011 ACE_INLINE 00012 OpenDDS::DCPS::ThreadSynchResource::ThreadSynchResource() 00013 : handle_(ACE_INVALID_HANDLE) 00014 , timeout_(0) 00015 { 00016 DBG_ENTRY_LVL("ThreadSynchResource","ThreadSynchResource",6); 00017 } 00018 00019 ACE_INLINE int 00020 OpenDDS::DCPS::ThreadSynchResource::wait_to_unclog() 00021 { 00022 DBG_ENTRY_LVL("ThreadSynchResource","wait_to_unclog",6); 00023 00024 if (ACE::handle_write_ready(this->handle_, this->timeout_) == -1) { 00025 if (errno == ETIME) { 00026 ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: handle_write_ready timed out\n")); 00027 this->notify_lost_on_backpressure_timeout(); 00028 00029 } else { 00030 ACE_ERROR((LM_ERROR, 00031 "(%P|%t) ERROR: ACE::handle_write_ready return -1 while waiting " 00032 " to unclog. %p \n", ACE_TEXT("handle_write_ready"))); 00033 } 00034 00035 return -1; 00036 } 00037 00038 return 0; 00039 } 00040 00041 ACE_INLINE void 00042 OpenDDS::DCPS::ThreadSynchResource::set_handle(ACE_HANDLE handle) 00043 { 00044 handle_ = handle; 00045 }