summaryrefslogtreecommitdiff
path: root/ACE/ace/OS_NS_Thread.inl
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/ace/OS_NS_Thread.inl')
-rw-r--r--ACE/ace/OS_NS_Thread.inl310
1 files changed, 44 insertions, 266 deletions
diff --git a/ACE/ace/OS_NS_Thread.inl b/ACE/ace/OS_NS_Thread.inl
index 4577d300926..d4bba743c56 100644
--- a/ACE/ace/OS_NS_Thread.inl
+++ b/ACE/ace/OS_NS_Thread.inl
@@ -45,7 +45,8 @@ void **&
ACE_TSS_Emulation::tss_base ()
{
# if defined (ACE_HAS_VXTHREADS)
- return (void **&) taskIdCurrent->ACE_VXWORKS_SPARE;
+ int &spare = taskIdCurrent->ACE_VXWORKS_SPARE;
+ return reinterpret_cast <void **&> (spare);
# else
// Uh oh.
ACE_NOTSUP_RETURN (0);
@@ -132,11 +133,7 @@ ACE_OS::condattr_destroy (ACE_condattr_t &attributes)
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- pthread_condattr_delete (&attributes);
-# else
pthread_condattr_destroy (&attributes);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
# elif defined (ACE_HAS_STHREADS)
attributes.type = 0;
@@ -166,23 +163,11 @@ ACE_OS::condattr_init (ACE_condattr_t &attributes,
ACE_OS::memset (&attributes, 0, sizeof (attributes));
# endif
if (
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- pthread_condattr_create (&attributes) == 0
-# elif defined (ACE_HAS_PTHREADS_STD) || defined (ACE_HAS_PTHREADS_DRAFT7)
ACE_ADAPT_RETVAL (pthread_condattr_init (&attributes), result) == 0
# if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)
&& ACE_ADAPT_RETVAL (pthread_condattr_setpshared (&attributes, type),
result) == 0
# endif /* _POSIX_THREAD_PROCESS_SHARED && ! ACE_LACKS_CONDATTR_PSHARED */
-# else /* this is draft 6 */
- pthread_condattr_init (&attributes) == 0
-# if !defined (ACE_LACKS_CONDATTR_PSHARED)
- && pthread_condattr_setpshared (&attributes, type) == 0
-# endif /* ACE_LACKS_CONDATTR_PSHARED */
-# if defined (ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP)
- && pthread_condattr_setkind_np (&attributes, type) == 0
-# endif /* ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP */
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
)
result = 0;
else
@@ -214,14 +199,10 @@ ACE_OS::cond_broadcast (ACE_cond_t *cv)
ACE_OS_TRACE ("ACE_OS::cond_broadcast");
# if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
- ACE_OSCALL_RETURN (pthread_cond_broadcast (cv), int, -1);
-# else
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_broadcast (cv),
result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_broadcast (cv),
@@ -240,12 +221,8 @@ ACE_OS::cond_destroy (ACE_cond_t *cv)
ACE_OS_TRACE ("ACE_OS::cond_destroy");
# if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
- ACE_OSCALL_RETURN (pthread_cond_destroy (cv), int, -1);
-# else
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_destroy (cv), result), int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_destroy (cv), result), int, -1);
@@ -279,15 +256,7 @@ ACE_OS::cond_init (ACE_cond_t *cv,
ACE_OS::memset (cv, 0, sizeof (*cv));
# endif
- if (
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- pthread_cond_init (cv, attributes) == 0
-# elif defined (ACE_HAS_PTHREADS_STD) || defined (ACE_HAS_PTHREADS_DRAFT7)
- ACE_ADAPT_RETVAL (pthread_cond_init (cv, &attributes), result) == 0
-# else /* this is draft 6 */
- pthread_cond_init (cv, &attributes) == 0
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
- )
+ if (ACE_ADAPT_RETVAL (pthread_cond_init (cv, &attributes), result) == 0)
result = 0;
else
result = -1; // ACE_ADAPT_RETVAL used it for intermediate status
@@ -335,13 +304,9 @@ ACE_OS::cond_signal (ACE_cond_t *cv)
ACE_OS_TRACE ("ACE_OS::cond_signal");
# if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
- ACE_OSCALL_RETURN (pthread_cond_signal (cv), int, -1);
-# else
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_signal (cv), result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_signal (cv), result), int, -1);
@@ -359,13 +324,9 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_OS_TRACE ("ACE_OS::cond_wait");
# if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
- ACE_OSCALL_RETURN (pthread_cond_wait (cv, external_mutex), int, -1);
-# else
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_wait (cv, external_mutex), result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_wait (cv, external_mutex), result),
@@ -393,25 +354,12 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
- if (timeout == 0)
- ACE_OSCALL (pthread_cond_wait (cv, external_mutex),
- int, -1, result);
- else
- {
- ACE_OSCALL (pthread_cond_timedwait (cv, external_mutex,
- (ACE_TIMESPEC_PTR) &ts),
- int, -1, result);
- }
-
-# else
ACE_OSCALL (ACE_ADAPT_RETVAL (timeout == 0
? pthread_cond_wait (cv, external_mutex)
: pthread_cond_timedwait (cv, external_mutex,
(ACE_TIMESPEC_PTR) &ts),
result),
int, -1, result);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6*/
// We need to adjust this to make the POSIX and Solaris return
// values consistent. EAGAIN is from Pthreads DRAFT4 (HP-UX 10.20 and down)
if (result == -1 &&
@@ -743,7 +691,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
#if defined (ACE_HAS_RECURSIVE_MUTEXES)
return ACE_OS::thread_mutex_lock (m);
#else
- ACE_thread_t t_id = ACE_OS::thr_self ();
+ ACE_thread_t const t_id = ACE_OS::thr_self ();
int result = 0;
// Acquire the guard.
@@ -2561,10 +2509,7 @@ ACE_OS::sigwait (sigset_t *sset, int *sig)
errno = ::_Psigwait (sset, sig);
return errno == 0 ? *sig : -1;
# else /* ! __Lynx __ && ! (DIGITAL_UNIX && __DECCXX_VER) */
-# if (defined (ACE_HAS_PTHREADS_DRAFT4) || (defined (ACE_HAS_PTHREADS_DRAFT6))) || (defined (_UNICOS) && _UNICOS == 9)
- *sig = ::sigwait (sset);
- return *sig;
-# elif defined (CYGWIN32)
+# if defined (CYGWIN32)
// Cygwin has sigwait definition, but it is not implemented
ACE_UNUSED_ARG (sset);
ACE_NOTSUP_RETURN (-1);
@@ -2574,7 +2519,7 @@ ACE_OS::sigwait (sigset_t *sset, int *sig)
# else /* this is draft 7 or std */
errno = ::sigwait (sset, sig);
return errno == 0 ? *sig : -1;
-# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */
+# endif /* CYGWIN32 */
# endif /* ! __Lynx__ && ! (DIGITAL_UNIX && __DECCXX_VER) */
# elif defined (ACE_HAS_WTHREADS)
ACE_UNUSED_ARG (sset);
@@ -2616,26 +2561,10 @@ ACE_OS::thr_cancel (ACE_thread_t thr_id)
ACE_OS_TRACE ("ACE_OS::thr_cancel");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
-# ifdef pthread_cancel
- // If it's a macro we can't say "pthread_cancel"...
- ACE_OSCALL_RETURN (pthread_cancel (thr_id), int, -1);
-# else
- ACE_OSCALL_RETURN (pthread_cancel (thr_id), int, -1);
-# endif /* pthread_cancel */
-# else
int result;
-# ifdef pthread_cancel
- // If it's a macro we can't say "pthread_cancel"...
- ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cancel (thr_id),
- result),
- int, -1);
-# else
- ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cancel (thr_id),
- result),
- int, -1);
-# endif /* pthread_cancel */
-# endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
+ ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cancel (thr_id),
+ result),
+ int, -1);
# elif defined (ACE_HAS_VXTHREADS)
ACE_OSCALL_RETURN (::taskDelete (thr_id), int, -1);
# else /* Could be ACE_HAS_PTHREADS && ACE_LACKS_PTHREAD_CANCEL */
@@ -2658,20 +2587,6 @@ ACE_OS::thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2)
# else
return pthread_equal (t1, t2);
# endif /* pthread_equal */
-#elif defined (ACE_HAS_VXTHREADS)
- // Guard against the fact that ACE_thread_t is a char* when using VxWorks.
- // Maybe the user passes in an unitialized ACE_thread_t, which is then 0,
- // which causes strcmp to cause an access violation.
- if (!t1 && !t2)
- return 1;
- else if (!t1 || !t2)
- return 0;
- else
- {
- t1 += t1[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
- t2 += t2[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
- return !ACE_OS::strcmp (t1, t2);
- }
#else /* For STHREADS, WTHREADS, and VXWORKS ... */
// Hum, Do we need to treat WTHREAD differently?
// levine 13 oct 98 % Probably, ACE_hthread_t is a HANDLE.
@@ -2714,15 +2629,7 @@ ACE_OS::thr_continue (ACE_hthread_t target_thread)
else
return 0;
# elif defined (ACE_HAS_VXTHREADS)
- // Skip over the ID-allocated marker, if present.
- target_thread += target_thread[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
- ACE_thread_t tid;
- ACE_OSCALL (::taskNameToId (target_thread), int, ERROR, tid);
-
- if (tid == ERROR)
- return -1;
- else
- ACE_OSCALL_RETURN (::taskResume (tid), int, -1);
+ ACE_OSCALL_RETURN (::taskResume (target_thread), int, -1);
# endif /* ACE_HAS_STHREADS */
#else
ACE_UNUSED_ARG (target_thread);
@@ -2756,26 +2663,6 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
# if (defined (ACE_HAS_PTHREADS) && \
(!defined (ACE_LACKS_SETSCHED) || defined (ACE_HAS_PTHREAD_SCHEDPARAM)))
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- int const result = pthread_getprio (ht_id);
- if (result != -1)
- {
- priority = result;
- return 0;
- }
- else
- return -1;
-# elif defined (ACE_HAS_PTHREADS_DRAFT6)
-
- pthread_attr_t attr;
- if (pthread_getschedattr (ht_id, &attr) == 0)
- {
- priority = pthread_attr_getprio (&attr);
- return 0;
- }
- return -1;
-# else
-
struct sched_param param;
int result;
@@ -2784,7 +2671,6 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
-1, result);
priority = param.sched_priority;
return result;
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_getprio (ht_id, &priority), result), int, -1);
@@ -2812,15 +2698,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy)
return 0;
# elif defined (ACE_HAS_VXTHREADS)
- // Skip over the ID-allocated marker, if present.
- ht_id += ht_id[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
- ACE_thread_t tid;
- ACE_OSCALL (::taskNameToId (ht_id), int, ERROR, tid);
-
- if (tid == ERROR)
- return -1;
- else
- ACE_OSCALL_RETURN (::taskPriorityGet (tid, &priority), int, -1);
+ ACE_OSCALL_RETURN (::taskPriorityGet (ht_id, &priority), int, -1);
# else
ACE_UNUSED_ARG (ht_id);
ACE_UNUSED_ARG (priority);
@@ -2847,12 +2725,8 @@ ACE_OS::thr_getspecific_native (ACE_OS_thread_key_t key, void **data)
{
// ACE_OS_TRACE ("ACE_OS::thr_getspecific_native");
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
- return pthread_getspecific (key, data);
-# else /* this is ACE_HAS_PTHREADS_DRAFT7 or STD */
*data = pthread_getspecific (key);
return 0;
-# endif /* ACE_HAS_PTHREADS */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_getspecific (key, data), result), int, -1);
@@ -2916,29 +2790,9 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle,
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_join (thr_handle, 0, status), result),
int, -1);
# elif defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
- int ace_result;
-# if defined (ACE_LACKS_NULL_PTHREAD_STATUS)
- void *temp;
- ACE_OSCALL (pthread_join (thr_handle,
- status == 0 ? &temp : status),
- int, -1, ace_result);
-# else
- ACE_OSCALL (pthread_join (thr_handle, status), int, -1, ace_result);
-# endif /* ACE_LACKS_NULL_PTHREAD_STATUS */
- // Joinable threads need to be detached after joining on Pthreads
- // draft 4 (at least) to reclaim thread storage.
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- pthread_detach (&thr_handle);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
-
- return ace_result;
-
-# else
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_join (thr_handle, status), result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */
# elif defined (ACE_HAS_WTHREADS)
ACE_THR_FUNC_RETURN local_status = 0;
@@ -2979,19 +2833,9 @@ ACE_OS::thr_join (ACE_thread_t waiter_id,
int, -1);
# elif defined (ACE_HAS_PTHREADS)
ACE_UNUSED_ARG (thr_id);
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
-# if defined (ACE_LACKS_NULL_PTHREAD_STATUS)
- void *temp;
- ACE_OSCALL_RETURN (pthread_join (waiter_id,
- status == 0 ? &temp : status), int, -1);
-# else
- ACE_OSCALL_RETURN (pthread_join (waiter_id, status), int, -1);
-# endif
-# else
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_join (waiter_id, status), result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */
# elif defined (ACE_HAS_WTHREADS)
ACE_UNUSED_ARG (waiter_id);
ACE_UNUSED_ARG (thr_id);
@@ -3016,7 +2860,7 @@ ACE_OS::thr_kill (ACE_thread_t thr_id, int signum)
ACE_OS_TRACE ("ACE_OS::thr_kill");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_LACKS_PTHREAD_KILL)
+# if defined (ACE_LACKS_PTHREAD_KILL)
ACE_UNUSED_ARG (signum);
ACE_UNUSED_ARG (thr_id);
ACE_NOTSUP_RETURN (-1);
@@ -3025,7 +2869,7 @@ ACE_OS::thr_kill (ACE_thread_t thr_id, int signum)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_kill (thr_id, signum),
result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
+# endif /* ACE_LACKS_PTHREAD_KILL */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_kill (thr_id, signum),
@@ -3107,6 +2951,20 @@ ACE_OS::thr_self (void)
#endif /* ACE_HAS_THREADS */
}
+ACE_INLINE const char*
+ACE_OS::thr_name (void)
+{
+#if defined (ACE_HAS_THREADS)
+#if defined (ACE_HAS_VXTHREADS)
+ return ::taskName (ACE_OS::thr_self ());
+#else
+ ACE_NOTSUP_RETURN (0);
+#endif
+#else
+ ACE_NOTSUP_RETURN (0);
+#endif
+}
+
ACE_INLINE void
ACE_OS::thr_self (ACE_hthread_t &self)
{
@@ -3122,7 +2980,7 @@ ACE_OS::thr_self (ACE_hthread_t &self)
# elif defined (ACE_HAS_WTHREADS)
self = ::GetCurrentThread ();
# elif defined (ACE_HAS_VXTHREADS)
- self = ::taskName(::taskIdSelf ());
+ self = ::taskIdSelf ();
# endif /* ACE_HAS_STHREADS */
#else
self = 1; // Might as well make it the main thread ;-)
@@ -3135,23 +2993,11 @@ ACE_OS::thr_setcancelstate (int new_state, int *old_state)
ACE_OS_TRACE ("ACE_OS::thr_setcancelstate");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL)
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- int old;
- old = pthread_setcancel (new_state);
- if (old == -1)
- return -1;
- *old_state = old;
- return 0;
-# elif defined (ACE_HAS_PTHREADS_DRAFT6)
- ACE_UNUSED_ARG (old_state);
- ACE_OSCALL_RETURN (pthread_setintr (new_state), int, -1);
-# else /* this is draft 7 or std */
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setcancelstate (new_state,
- old_state),
+ old_state),
result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
# elif defined (ACE_HAS_STHREADS)
ACE_UNUSED_ARG (new_state);
ACE_UNUSED_ARG (old_state);
@@ -3178,23 +3024,11 @@ ACE_OS::thr_setcanceltype (int new_type, int *old_type)
ACE_OS_TRACE ("ACE_OS::thr_setcanceltype");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL)
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- int old;
- old = pthread_setasynccancel (new_type);
- if (old == -1)
- return -1;
- *old_type = old;
- return 0;
-# elif defined (ACE_HAS_PTHREADS_DRAFT6)
- ACE_UNUSED_ARG (old_type);
- ACE_OSCALL_RETURN (pthread_setintrtype (new_type), int, -1);
-# else /* this is draft 7 or std */
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setcanceltype (new_type,
- old_type),
+ old_type),
result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
# else /* Could be ACE_HAS_PTHREADS && ACE_LACKS_PTHREAD_CANCEL */
ACE_UNUSED_ARG (new_type);
ACE_UNUSED_ARG (old_type);
@@ -3241,18 +3075,6 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy)
# if (defined (ACE_HAS_PTHREADS) && \
(!defined (ACE_LACKS_SETSCHED) || defined (ACE_HAS_PTHREAD_SCHEDPARAM)))
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
- int result;
- result = pthread_setprio (ht_id, priority);
- return (result == -1 ? -1 : 0);
-# elif defined (ACE_HAS_PTHREADS_DRAFT6)
- pthread_attr_t attr;
- if (pthread_getschedattr (ht_id, &attr) == -1)
- return -1;
- if (pthread_attr_setprio (attr, priority) == -1)
- return -1;
- return pthread_setschedattr (ht_id, attr);
-# else
int result;
struct sched_param param;
ACE_OS::memset ((void *) &param, 0, sizeof param);
@@ -3272,11 +3094,10 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy)
param.sched_priority = priority;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setschedparam (ht_id,
- policy,
- &param),
+ policy,
+ &param),
result),
int, -1);
-# endif /* ACE_HAS_PTHREADS_DRAFT4 */
# elif defined (ACE_HAS_STHREADS)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_setprio (ht_id, priority),
@@ -3287,15 +3108,7 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy)
ace_result_),
int, -1);
# elif defined (ACE_HAS_VXTHREADS)
- // Skip over the ID-allocated marker, if present.
- ht_id += ht_id[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
- ACE_thread_t tid;
- ACE_OSCALL (::taskNameToId (ht_id), int, ERROR, tid);
-
- if (tid == ERROR)
- return -1;
- else
- ACE_OSCALL_RETURN (::taskPrioritySet (tid, priority), int, -1);
+ ACE_OSCALL_RETURN (::taskPrioritySet (ht_id, priority), int, -1);
# else
// For example, platforms that support Pthreads but LACK_SETSCHED.
ACE_UNUSED_ARG (ht_id);
@@ -3333,21 +3146,13 @@ ACE_OS::thr_sigsetmask (int how,
result),
int, -1);
# elif defined (ACE_HAS_PTHREADS)
- // Draft 4 and 6 implementations will sometimes have a sigprocmask () that
- // modifies the calling thread's mask only. If this is not so for your
- // platform, define ACE_LACKS_PTHREAD_THR_SIGSETMASK.
-# if defined (ACE_HAS_PTHREADS_DRAFT4) || \
- defined (ACE_HAS_PTHREADS_DRAFT6) || (defined (_UNICOS) && _UNICOS == 9)
- //FUZZ: disable check_for_lack_ACE_OS
- ACE_OSCALL_RETURN (::sigprocmask (how, nsm, osm), int, -1);
- //FUZZ: enable check_for_lack_ACE_OS
-# elif !defined (ACE_LACKS_PTHREAD_SIGMASK)
+# if !defined (ACE_LACKS_PTHREAD_SIGMASK)
int result;
//FUZZ: disable check_for_lack_ACE_OS
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_sigmask (how, nsm, osm),
result), int, -1);
//FUZZ: enable check_for_lack_ACE_OS
-# endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 || _UNICOS 9 */
+# endif /* !ACE_LACKS_PTHREAD_SIGMASK */
#if 0
/* Don't know if any platform actually needs this... */
@@ -3433,15 +3238,7 @@ ACE_OS::thr_suspend (ACE_hthread_t target_thread)
ACE_FAIL_RETURN (-1);
/* NOTREACHED */
# elif defined (ACE_HAS_VXTHREADS)
- // Skip over the ID-allocated marker, if present.
- target_thread += target_thread[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
- ACE_thread_t tid;
- ACE_OSCALL (::taskNameToId (target_thread), int, ERROR, tid);
-
- if (tid == ERROR)
- return -1;
- else
- ACE_OSCALL_RETURN (::taskSuspend (tid), int, -1);
+ ACE_OSCALL_RETURN (::taskSuspend (target_thread), int, -1);
# endif /* ACE_HAS_STHREADS */
#else
ACE_UNUSED_ARG (target_thread);
@@ -3455,11 +3252,7 @@ ACE_OS::thr_testcancel (void)
ACE_OS_TRACE ("ACE_OS::thr_testcancel");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL)
-#if defined(ACE_HAS_PTHREADS_DRAFT6)
- pthread_testintr ();
-#else /* ACE_HAS_PTHREADS_DRAFT6 */
pthread_testcancel ();
-#endif /* !ACE_HAS_PTHREADS_DRAFT6 */
# elif defined (ACE_HAS_STHREADS)
# elif defined (ACE_HAS_WTHREADS)
# elif defined (ACE_HAS_VXTHREADS)
@@ -3476,14 +3269,7 @@ ACE_OS::thr_yield (void)
ACE_OS_TRACE ("ACE_OS::thr_yield");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_STD)
- // Note - this is a POSIX.4 function - not a POSIX.1c function...
::sched_yield ();
-# elif defined (ACE_HAS_PTHREADS_DRAFT6)
- pthread_yield (0);
-# else /* Draft 4 and 7 */
- pthread_yield ();
-# endif /* ACE_HAS_PTHREADS_STD */
# elif defined (ACE_HAS_STHREADS)
::thr_yield ();
# elif defined (ACE_HAS_WTHREADS)
@@ -3508,12 +3294,9 @@ ACE_OS::thread_mutex_destroy (ACE_thread_mutex_t *m)
# if defined (ACE_HAS_WTHREADS)
::DeleteCriticalSection (m);
return 0;
-
-# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS) || defined (ACE_VXWORKS)
+# else
return ACE_OS::mutex_destroy (m);
-
-# endif /* ACE_HAS_STHREADS || ACE_HAS_PTHREADS */
-
+# endif /* ACE_HAS_WTHREADS */
#else
ACE_UNUSED_ARG (m);
ACE_NOTSUP_RETURN (-1);
@@ -3548,7 +3331,7 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS)
// Force the use of USYNC_THREAD!
return ACE_OS::mutex_init (m, USYNC_THREAD, name, arg, 0, lock_type);
-# elif defined (ACE_VXWORKS)
+# elif defined (ACE_HAS_VXTHREADS)
return mutex_init (m, lock_type, name, arg);
# endif /* ACE_HAS_STHREADS || ACE_HAS_PTHREADS */
@@ -3591,12 +3374,9 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS)
// Force the use of USYNC_THREAD!
return ACE_OS::mutex_init (m, USYNC_THREAD, name, arg, 0, lock_type);
-
-# elif defined (ACE_VXWORKS)
+# elif defined (ACE_HAS_VXTHREADS)
return mutex_init (m, lock_type, name, arg);
-
# endif /* ACE_HAS_STHREADS || ACE_HAS_PTHREADS */
-
#else
ACE_UNUSED_ARG (m);
ACE_UNUSED_ARG (lock_type);
@@ -3616,9 +3396,9 @@ ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m)
# if defined (ACE_HAS_WTHREADS)
::EnterCriticalSection (m);
return 0;
-# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS) || defined (ACE_VXWORKS)
+# else
return ACE_OS::mutex_lock (m);
-# endif /* ACE_HAS_STHREADS || ACE_HAS_PTHREADS || VXWORKS */
+# endif /* ACE_HAS_WTHREADS */
#else
ACE_UNUSED_ARG (m);
ACE_NOTSUP_RETURN (-1);
@@ -3640,9 +3420,7 @@ ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m,
// Windows synchronization mechanism.
#if defined (ACE_HAS_THREADS) && !defined (ACE_HAS_WTHREADS)
-# if defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS) || defined (ACE_VXWORKS)
return ACE_OS::mutex_lock (m, timeout);
-#endif /* ACE_HAS_STHREADS || ACE_HAS_PTHREADS || VXWORKS */
#else
ACE_UNUSED_ARG (m);
ACE_UNUSED_ARG (timeout);
@@ -3697,9 +3475,9 @@ ACE_OS::thread_mutex_unlock (ACE_thread_mutex_t *m)
# if defined (ACE_HAS_WTHREADS)
::LeaveCriticalSection (m);
return 0;
-# elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS) || defined (ACE_VXWORKS)
+# else
return ACE_OS::mutex_unlock (m);
-# endif /* Threads variety case */
+# endif /* ACE_HAS_WTHREADS */
#else
ACE_UNUSED_ARG (m);
ACE_NOTSUP_RETURN (-1);