Line data Source code
1 : /* 2 : * 3 : * 4 : * Distributed under the OpenDDS License. 5 : * See: http://www.opendds.org/license.html 6 : */ 7 : 8 : #include "ThreadSynchResource.h" 9 : #include "EntryExit.h" 10 : 11 : /// Note that we allow the ThreadSynchResource pointer to be NULL to 12 : /// support the NullSynch case. 13 : ACE_INLINE 14 : OpenDDS::DCPS::ThreadSynch::ThreadSynch(ThreadSynchResource* resource) 15 : : resource_(resource) 16 : { 17 : DBG_ENTRY_LVL("ThreadSynch","ThreadSynch",6); 18 : } 19 : 20 : ACE_INLINE 21 : OpenDDS::DCPS::WeakRcHandle<OpenDDS::DCPS::ThreadSynchWorker> 22 : OpenDDS::DCPS::ThreadSynch::worker() 23 : { 24 : return worker_; 25 : } 26 : 27 : ACE_INLINE int 28 0 : OpenDDS::DCPS::ThreadSynch::register_worker(ThreadSynchWorker& worker) 29 : { 30 : DBG_ENTRY_LVL("ThreadSynch","register_worker",6); 31 0 : this->worker_ = worker; 32 0 : if (resource_) 33 0 : resource_->set_handle(worker.get_handle()); 34 0 : return this->register_worker_i(); 35 : } 36 : 37 : ACE_INLINE void 38 0 : OpenDDS::DCPS::ThreadSynch::unregister_worker() 39 : { 40 : DBG_ENTRY_LVL("ThreadSynch","unregister_worker",6); 41 0 : this->unregister_worker_i(); 42 0 : } 43 : 44 : 45 : ACE_INLINE int 46 : OpenDDS::DCPS::ThreadSynch::wait_on_clogged_resource() 47 : { 48 : DBG_ENTRY_LVL("ThreadSynch","wait_on_clogged_resource",6); 49 : 50 : int result = -1; 51 : 52 : if (this->resource_) { 53 : result = this->resource_->wait_to_unclog(); 54 : 55 : } else { 56 : ACE_ERROR((LM_ERROR, 57 : "(%P|%t) ERROR: ThreadSynch cannot wait on a NULL clogged resource.\n")); 58 : } 59 : 60 : return result; 61 : }