2 #if defined (ACE_HAS_TOKENS_LIBRARY)
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
6 // ************************************************************
9 ACE_Token_Proxy_Queue::size (void)
11 ACE_TRACE ("ACE_Token_Proxy_Queue::size");
15 // ************************************************************
18 ACE_TPQ_Entry::waiting (void) const
20 ACE_TRACE ("ACE_TPQ_Entry::waiting");
25 ACE_TPQ_Entry::waiting (int v)
27 ACE_TRACE ("ACE_TPQ_Entry::waiting");
31 ACE_INLINE const ACE_TCHAR *
32 ACE_TPQ_Entry::client_id (void) const
34 ACE_TRACE ("ACE_TPQ_Entry::client_id");
35 return this->client_id_;
38 ACE_INLINE ACE_Token_Proxy *
39 ACE_TPQ_Entry::proxy (void) const
41 ACE_TRACE ("ACE_TPQ_Entry::proxy");
46 ACE_TPQ_Entry::proxy (ACE_Token_Proxy *proxy)
48 ACE_TRACE ("ACE_TPQ_Entry::proxy");
53 ACE_TPQ_Iterator::~ACE_TPQ_Iterator (void)
58 ACE_Token_Proxy_Queue::~ACE_Token_Proxy_Queue (void)
63 ACE_Tokens::remove (ACE_TPQ_Entry *caller)
65 this->waiters_.remove (caller);
69 ACE_Tokens::dec_reference (void)
71 ACE_TRACE ("ACE_Tokens::dec_reference");
72 if (this->reference_count_ == 0)
74 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("dec_reference already zero")));
78 return --this->reference_count_;
82 ACE_Tokens::inc_reference (void)
84 ACE_TRACE ("ACE_Tokens::inc_reference");
85 ++this->reference_count_;
88 ACE_INLINE const ACE_TPQ_Entry *
89 ACE_Token_Proxy_Queue::head (void)
91 ACE_TRACE ("ACE_Token_Proxy_Queue::head");
98 // **************************************************
99 // **************************************************
100 // **************************************************
103 ACE_Tokens::visit (int v)
105 ACE_TRACE ("ACE_Tokens::visit");
110 ACE_Tokens::visited (void)
112 ACE_TRACE ("ACE_Tokens::visited");
116 ACE_INLINE ACE_TPQ_Entry *
117 ACE_Tokens::owner (void)
119 ACE_TRACE ("ACE_Tokens::owner");
120 return (ACE_TPQ_Entry *) this->waiters_.head ();
123 ACE_INLINE const ACE_TCHAR*
124 ACE_Tokens::owner_id ()
126 ACE_TRACE ("ACE_Tokens::owner_id");
127 if (this->owner () == 0)
128 return ACE_TEXT ("no owner");
130 return this->owner ()->client_id ();
133 ACE_INLINE const ACE_TCHAR*
134 ACE_Tokens::name (void)
136 ACE_TRACE ("ACE_Tokens::name");
137 return this->token_name_;
140 // ************************************************************
143 ACE_TPQ_Entry::nesting_level (void) const
145 ACE_TRACE ("ACE_TPQ_Entry::nesting_level");
146 return this->nesting_level_;
150 ACE_TPQ_Entry::nesting_level (int delta)
152 ACE_TRACE ("ACE_TPQ_Entry::nesting_level");
153 this->nesting_level_ += delta;
156 ACE_INLINE ACE_TPQ_Entry::PTVF
157 ACE_TPQ_Entry::sleep_hook (void) const
159 ACE_TRACE ("ACE_TPQ_Entry::sleep_hook");
160 return this->sleep_hook_;
164 ACE_TPQ_Entry::sleep_hook (void (*sh)(void *))
166 ACE_TRACE ("ACE_TPQ_Entry::sleep_hook");
167 this->sleep_hook_ = sh;
171 ACE_TPQ_Entry::call_sleep_hook (void)
173 ACE_TRACE ("ACE_TPQ_Entry::call_sleep_hook");
175 // if a function has been registered, call it.
176 if (this->sleep_hook () != 0)
177 this->sleep_hook () ((void *) this->proxy ());
179 // otherwise, call back the sleep_hook method
180 this->proxy ()->sleep_hook ();
184 ACE_TPQ_Entry::equal_client_id (const ACE_TCHAR *id)
186 ACE_TRACE ("ACE_TPQ_Entry::equal_client_id");
187 return (ACE_OS::strcmp (this->client_id (), id) == 0);
190 // ************************************************************
191 // ************************************************************
192 // ************************************************************
195 ACE_Local_Mutex::ACE_Local_Mutex (const ACE_TCHAR *token_name,
199 ACE_TRACE ("ACE_Local_Mutex::ACE_Local_Mutex");
200 this->open (token_name, ignore_deadlock, debug);
204 ACE_Token_Name::name (const ACE_TCHAR *new_name)
206 ACE_TRACE ("ACE_Token_Name::name");
209 new_name = ACE_TEXT ("no name");
211 size_t n = ACE_OS::strlen (new_name) + 1;
213 if (n >= ACE_MAXTOKENNAMELEN)
214 n = ACE_MAXTOKENNAMELEN - 1;
216 ACE_OS::strsncpy (this->token_name_, (ACE_TCHAR *) new_name, n);
219 ACE_INLINE const ACE_TCHAR*
220 ACE_Token_Name::name (void) const
222 ACE_TRACE ("ACE_Token_Name::name");
223 return this->token_name_;
226 // ************************************************************
229 ACE_Local_RLock::ACE_Local_RLock (const ACE_TCHAR *token_name,
233 ACE_TRACE ("ACE_Local_RLock::ACE_Local_RLock");
234 this->open (token_name, ignore_deadlock, debug);
237 // ************************************************************
240 ACE_Local_WLock::ACE_Local_WLock (const ACE_TCHAR *token_name,
244 ACE_TRACE ("ACE_Local_WLock::ACE_Local_WLock");
245 this->open (token_name, ignore_deadlock, debug);
248 // ************************************************************
252 ACE_Token_Name::operator= (const ACE_Token_Name &rhs)
254 ACE_TRACE ("ACE_Token_Name::operator=");
258 this->name (rhs.name ());
262 ACE_Token_Name::operator== (const ACE_Token_Name &rhs) const
264 ACE_TRACE ("ACE_Token_Name::operator==");
266 // the name and type must be the same
267 return (ACE_OS::strcmp (this->token_name_, rhs.name ()) == 0);
270 ACE_END_VERSIONED_NAMESPACE_DECL
272 #endif /* ACE_HAS_TOKENS_LIBRARY */