2 #include "ace/OS_NS_string.h"
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
6 // Allocates a <keyp> that is used to identify data that is specific
7 // to each thread in the process. The key is global to all threads in
11 ACE_Thread::keycreate (ACE_thread_key_t *keyp,
12 #if defined (ACE_HAS_THR_C_DEST)
13 ACE_THR_C_DEST destructor
15 ACE_THR_DEST destructor
16 #endif /* ACE_HAS_THR_C_DEST */
19 // ACE_TRACE ("ACE_Thread::keycreate");
20 return ACE_OS::thr_keycreate (keyp, destructor);
23 // Free up the key so that other threads can reuse it.
26 ACE_Thread::keyfree (ACE_thread_key_t key)
28 ACE_TRACE ("ACE_Thread::keyfree");
29 return ACE_OS::thr_keyfree (key);
32 // Bind value to the thread-specific data key, <key>, for the calling
36 ACE_Thread::setspecific (ACE_thread_key_t key, void *value)
38 // ACE_TRACE ("ACE_Thread::setspecific");
39 return ACE_OS::thr_setspecific (key, value);
42 // Stores the current value bound to <key> for the calling thread
43 // into the location pointed to by <valuep>.
46 ACE_Thread::getspecific (ACE_thread_key_t key, void **valuep)
48 // ACE_TRACE ("ACE_Thread::getspecific");
49 return ACE_OS::thr_getspecific (key, valuep);
52 ACE_INLINE ACE_thread_t
53 ACE_Thread::self (void)
55 // ACE_TRACE ("ACE_Thread::self");
56 return ACE_OS::thr_self ();
60 ACE_Thread::exit (ACE_THR_FUNC_RETURN status)
62 ACE_TRACE ("ACE_Thread::exit");
63 ACE_OS::thr_exit (status);
67 ACE_Thread::yield (void)
69 ACE_TRACE ("ACE_Thread::yield");
74 ACE_Thread::spawn (ACE_THR_FUNC func,
78 ACE_hthread_t *t_handle,
81 size_t thr_stack_size,
82 ACE_Thread_Adapter *thread_adapter,
83 const char** thr_name)
85 ACE_TRACE ("ACE_Thread::spawn");
87 return ACE_OS::thr_create (func,
100 ACE_Thread::resume (ACE_hthread_t t_id)
102 ACE_TRACE ("ACE_Thread::resume");
103 return ACE_OS::thr_continue (t_id);
107 ACE_Thread::suspend (ACE_hthread_t t_id)
109 ACE_TRACE ("ACE_Thread::suspend");
110 return ACE_OS::thr_suspend (t_id);
114 ACE_Thread::kill (ACE_thread_t t_id, int signum)
116 ACE_TRACE ("ACE_Thread::kill");
117 return ACE_OS::thr_kill (t_id, signum);
121 ACE_Thread::join (ACE_thread_t wait_for,
122 ACE_thread_t *departed,
123 ACE_THR_FUNC_RETURN *status)
125 ACE_TRACE ("ACE_Thread::join");
126 return ACE_OS::thr_join (wait_for, departed, status);
130 ACE_Thread::join (ACE_hthread_t wait_for,
131 ACE_THR_FUNC_RETURN *status)
133 ACE_TRACE ("ACE_Thread::join");
134 return ACE_OS::thr_join (wait_for, status);
138 ACE_Thread::getconcurrency (void)
140 ACE_TRACE ("ACE_Thread::getconcurrency");
141 return ACE_OS::thr_getconcurrency ();
145 ACE_Thread::setconcurrency (int new_level)
147 ACE_TRACE ("ACE_Thread::setconcurrency");
148 return ACE_OS::thr_setconcurrency (new_level);
152 ACE_Thread::sigsetmask (int how,
153 const sigset_t *sigset,
156 ACE_TRACE ("ACE_Thread::sigsetmask");
157 return ACE_OS::thr_sigsetmask (how, sigset, osigset);
161 ACE_Thread::disablecancel (struct cancel_state *old_state)
163 ACE_TRACE ("ACE_Thread::disablecancel");
165 int result = ACE_OS::thr_setcancelstate (THR_CANCEL_DISABLE,
167 if (result == 0 && old_state != 0)
169 ACE_OS::memset (old_state,
171 sizeof (*old_state));
172 old_state->cancelstate = old_cstate;
179 ACE_Thread::enablecancel (struct cancel_state *old_state,
182 ACE_TRACE ("ACE_Thread::enablecancel");
187 result = ACE_OS::thr_setcancelstate (THR_CANCEL_ENABLE,
192 result = ACE_OS::thr_setcanceltype (flag,
199 old_state->cancelstate = old_cstate;
200 old_state->canceltype = old_ctype;
207 ACE_Thread::setcancelstate (struct cancel_state &new_state,
208 struct cancel_state *old_state)
210 ACE_TRACE ("ACE_Thread::setcancelstate");
214 if (new_state.cancelstate != 0
215 && ACE_OS::thr_setcancelstate (new_state.cancelstate,
219 if (new_state.canceltype != 0
220 && ACE_OS::thr_setcanceltype (new_state.canceltype,
225 ACE_OS::thr_setcancelstate (old_cstate,
232 old_state->cancelstate = old_cstate;
233 old_state->canceltype = old_ctype;
240 ACE_Thread::cancel (ACE_thread_t t_id)
242 ACE_TRACE ("ACE_Thread::cancel");
244 return ACE_OS::thr_cancel (t_id);
248 ACE_Thread::testcancel (void)
250 ACE_TRACE ("ACE_Thread::testcancel");
252 ACE_OS::thr_testcancel ();
256 ACE_Thread::self (ACE_hthread_t &t_id)
258 // ACE_TRACE ("ACE_Thread::self");
259 ACE_OS::thr_self (t_id);
263 ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority)
265 ACE_TRACE ("ACE_Thread::getprio");
266 return ACE_OS::thr_getprio (ht_id, priority);
270 ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority, int &policy)
272 ACE_TRACE ("ACE_Thread::getprio");
273 return ACE_OS::thr_getprio (ht_id, priority, policy);
277 ACE_Thread::setprio (ACE_hthread_t ht_id, int priority, int policy)
279 ACE_TRACE ("ACE_Thread::setprio");
280 return ACE_OS::thr_setprio (ht_id, priority, policy);
283 ACE_END_VERSIONED_NAMESPACE_DECL