Revert to Current Include Style
[ACE_TAO.git] / ACE / ace / Synch_Options.cpp
bloba407a4583b10daccf9b89b62c2cee19d5d4c39e1
1 #include "ace/Synch_Options.h"
3 #include "ace/Global_Macros.h"
4 #include "ace/config-all.h"
6 #if defined (ACE_HAS_ALLOC_HOOKS)
7 # include "ace/Malloc_Base.h"
8 #endif /* ACE_HAS_ALLOC_HOOKS */
10 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
12 ACE_ALLOC_HOOK_DEFINE (ACE_Synch_Options)
14 void
15 ACE_Synch_Options::dump () const
17 #if defined (ACE_HAS_DUMP)
18 ACE_TRACE ("ACE_Synch_Options::dump");
19 #endif /* ACE_HAS_DUMP */
22 // Static initialization.
23 // Note: these three objects require static construction and destruction.
25 /* static */
26 ACE_Synch_Options ACE_Synch_Options::defaults;
28 /* static */
29 ACE_Synch_Options ACE_Synch_Options::synch;
31 /* static */
32 ACE_Synch_Options ACE_Synch_Options::asynch (ACE_Synch_Options::USE_REACTOR);
34 ACE_Synch_Options::ACE_Synch_Options (unsigned long options,
35 const ACE_Time_Value &timeout,
36 const void *arg)
38 // ACE_TRACE ("ACE_Synch_Options::ACE_Synch_Options");
39 this->set (options, timeout, arg);
42 void
43 ACE_Synch_Options::set (unsigned long options,
44 const ACE_Time_Value &timeout,
45 const void *arg)
47 // ACE_TRACE ("ACE_Synch_Options::set");
48 this->options_ = options;
49 this->timeout_ = timeout;
52 * Not using ACE_Time_Value::zero because of possible static init order
53 * dependence. It would work fine because the memory would all zeros anyways,
54 * but ubsan complains about it.
56 if (timeout_ != ACE_Time_Value(0))
57 ACE_SET_BITS (this->options_, ACE_Synch_Options::USE_TIMEOUT);
59 this->arg_ = arg;
62 bool
63 ACE_Synch_Options::operator[] (unsigned long option) const
65 ACE_TRACE ("ACE_Synch_Options::operator[]");
66 return (this->options_ & option) != 0;
69 void
70 ACE_Synch_Options::operator= (unsigned long option)
72 ACE_TRACE ("ACE_Synch_Options::operator=");
73 this->options_ |= option;
76 const ACE_Time_Value &
77 ACE_Synch_Options::timeout () const
79 ACE_TRACE ("ACE_Synch_Options::timeout");
80 return this->timeout_;
83 void
84 ACE_Synch_Options::timeout (const ACE_Time_Value &tv)
86 ACE_TRACE ("ACE_Synch_Options::timeout");
87 this->timeout_ = tv;
90 const ACE_Time_Value *
91 ACE_Synch_Options::time_value () const
93 ACE_TRACE ("ACE_Synch_Options::time_value");
94 return (*this)[USE_TIMEOUT] ? &this->timeout_ : 0;
97 const void *
98 ACE_Synch_Options::arg () const
100 ACE_TRACE ("ACE_Synch_Options::arg");
101 return this->arg_;
104 void
105 ACE_Synch_Options::arg (const void *a)
107 ACE_TRACE ("ACE_Synch_Options::arg");
108 this->arg_ = a;
111 ACE_END_VERSIONED_NAMESPACE_DECL