2 #if defined (ACE_HAS_TOKENS_LIBRARY)
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
6 // ************************************************************
9 ACE_Token_Proxy_Queue::size ()
11 ACE_TRACE ("ACE_Token_Proxy_Queue::size");
15 // ************************************************************
18 ACE_TPQ_Entry::waiting () 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 () 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 () 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_Tokens::remove (ACE_TPQ_Entry *caller)
55 this->waiters_.remove (caller);
59 ACE_Tokens::dec_reference ()
61 ACE_TRACE ("ACE_Tokens::dec_reference");
62 if (this->reference_count_ == 0)
64 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("dec_reference already zero")));
68 return --this->reference_count_;
72 ACE_Tokens::inc_reference ()
74 ACE_TRACE ("ACE_Tokens::inc_reference");
75 ++this->reference_count_;
78 ACE_INLINE const ACE_TPQ_Entry *
79 ACE_Token_Proxy_Queue::head ()
81 ACE_TRACE ("ACE_Token_Proxy_Queue::head");
88 // **************************************************
91 ACE_Tokens::visit (int v)
93 ACE_TRACE ("ACE_Tokens::visit");
98 ACE_Tokens::visited ()
100 ACE_TRACE ("ACE_Tokens::visited");
104 ACE_INLINE ACE_TPQ_Entry *
107 ACE_TRACE ("ACE_Tokens::owner");
108 return (ACE_TPQ_Entry *) this->waiters_.head ();
111 ACE_INLINE const ACE_TCHAR*
112 ACE_Tokens::owner_id ()
114 ACE_TRACE ("ACE_Tokens::owner_id");
115 if (this->owner () == 0)
116 return ACE_TEXT ("no owner");
118 return this->owner ()->client_id ();
121 ACE_INLINE const ACE_TCHAR*
124 ACE_TRACE ("ACE_Tokens::name");
125 return this->token_name_;
128 // ************************************************************
131 ACE_TPQ_Entry::nesting_level () const
133 ACE_TRACE ("ACE_TPQ_Entry::nesting_level");
134 return this->nesting_level_;
138 ACE_TPQ_Entry::nesting_level (int delta)
140 ACE_TRACE ("ACE_TPQ_Entry::nesting_level");
141 this->nesting_level_ += delta;
144 ACE_INLINE ACE_TPQ_Entry::PTVF
145 ACE_TPQ_Entry::sleep_hook () const
147 ACE_TRACE ("ACE_TPQ_Entry::sleep_hook");
148 return this->sleep_hook_;
152 ACE_TPQ_Entry::sleep_hook (void (*sh)(void *))
154 ACE_TRACE ("ACE_TPQ_Entry::sleep_hook");
155 this->sleep_hook_ = sh;
159 ACE_TPQ_Entry::call_sleep_hook ()
161 ACE_TRACE ("ACE_TPQ_Entry::call_sleep_hook");
163 // if a function has been registered, call it.
164 if (this->sleep_hook () != 0)
165 this->sleep_hook () ((void *) this->proxy ());
167 // otherwise, call back the sleep_hook method
168 this->proxy ()->sleep_hook ();
172 ACE_TPQ_Entry::equal_client_id (const ACE_TCHAR *id)
174 ACE_TRACE ("ACE_TPQ_Entry::equal_client_id");
175 return (ACE_OS::strcmp (this->client_id (), id) == 0);
178 // ************************************************************
181 ACE_Local_Mutex::ACE_Local_Mutex (const ACE_TCHAR *token_name,
185 ACE_TRACE ("ACE_Local_Mutex::ACE_Local_Mutex");
186 this->open (token_name, ignore_deadlock, debug);
190 ACE_Token_Name::name (const ACE_TCHAR *new_name)
192 ACE_TRACE ("ACE_Token_Name::name");
195 new_name = ACE_TEXT ("no name");
197 size_t n = ACE_OS::strlen (new_name) + 1;
199 if (n >= ACE_MAXTOKENNAMELEN)
200 n = ACE_MAXTOKENNAMELEN - 1;
202 ACE_OS::strsncpy (this->token_name_, (ACE_TCHAR *) new_name, n);
205 ACE_INLINE const ACE_TCHAR*
206 ACE_Token_Name::name () const
208 ACE_TRACE ("ACE_Token_Name::name");
209 return this->token_name_;
212 // ************************************************************
215 ACE_Local_RLock::ACE_Local_RLock (const ACE_TCHAR *token_name,
219 ACE_TRACE ("ACE_Local_RLock::ACE_Local_RLock");
220 this->open (token_name, ignore_deadlock, debug);
223 // ************************************************************
226 ACE_Local_WLock::ACE_Local_WLock (const ACE_TCHAR *token_name,
230 ACE_TRACE ("ACE_Local_WLock::ACE_Local_WLock");
231 this->open (token_name, ignore_deadlock, debug);
234 // ************************************************************
238 ACE_Token_Name::operator= (const ACE_Token_Name &rhs)
240 ACE_TRACE ("ACE_Token_Name::operator=");
243 this->name (rhs.name ());
248 ACE_Token_Name::operator== (const ACE_Token_Name &rhs) const
250 ACE_TRACE ("ACE_Token_Name::operator==");
252 // the name and type must be the same
253 return (ACE_OS::strcmp (this->token_name_, rhs.name ()) == 0);
256 ACE_END_VERSIONED_NAMESPACE_DECL
258 #endif /* ACE_HAS_TOKENS_LIBRARY */