OpenDDS  Snapshot(2023/04/28-20:55)
ThreadSynch.inl
Go to the documentation of this file.
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.
15  : resource_(resource)
16 {
17  DBG_ENTRY_LVL("ThreadSynch","ThreadSynch",6);
18 }
19 
23 {
24  return worker_;
25 }
26 
27 ACE_INLINE int
29 {
30  DBG_ENTRY_LVL("ThreadSynch","register_worker",6);
31  this->worker_ = worker;
32  if (resource_)
33  resource_->set_handle(worker.get_handle());
34  return this->register_worker_i();
35 }
36 
37 ACE_INLINE void
39 {
40  DBG_ENTRY_LVL("ThreadSynch","unregister_worker",6);
41  this->unregister_worker_i();
42 }
43 
44 
45 ACE_INLINE int
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 {
57  "(%P|%t) ERROR: ThreadSynch cannot wait on a NULL clogged resource.\n"));
58  }
59 
60  return result;
61 }
WeakRcHandle< ThreadSynchWorker > worker()
Access the worker implementation directly.
Definition: ThreadSynch.inl:22
ThreadSynch(ThreadSynchResource *resource)
Definition: ThreadSynch.inl:14
#define ACE_ERROR(X)
virtual ACE_HANDLE get_handle()=0
virtual void unregister_worker_i()
Definition: ThreadSynch.cpp:29
unique_ptr< ThreadSynchResource > resource_
Definition: ThreadSynch.h:75
int register_worker(ThreadSynchWorker &worker)
Definition: ThreadSynch.inl:28
void unregister_worker()
Our owner, the worker_, is breaking our relationship.
Definition: ThreadSynch.inl:38
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
WeakRcHandle< ThreadSynchWorker > worker_
Definition: ThreadSynch.h:74
#define ACE_INLINE
LM_ERROR
virtual int register_worker_i()
Definition: ThreadSynch.cpp:21