summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rw-r--r--ChangeLogs/ChangeLog-02a33
-rw-r--r--ChangeLogs/ChangeLog-03a33
-rw-r--r--ace/OS.cpp60
-rw-r--r--ace/OS.h157
-rw-r--r--ace/OS.i35
-rw-r--r--ace/Sched_Params.cpp124
-rw-r--r--ace/Thread_Manager.cpp6
-rw-r--r--ace/config-sunos5.8.h14
9 files changed, 375 insertions, 120 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f262c1e611..d9f429a1e66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+Tue Jul 24 16:41:57 2001 Joe Hoffert <joeh@cs.wustl.edu>
+
+ * ace/Thread_Manager.cpp :
+ Added "&& ! defined (ACE_HAS_PACE)" ifdefs to already existing
+ #if defined (VXWORKS) sections of code to get ACE_HAS_PACE to
+ compile on VxWorks.
+
+ * ace/OS.i :
+ * ace/OS.cpp:
+ Fixed formatting of some comments and added needed PACE
+ calls for ACE_HAS_PACE on VxWorks.
+
+ * ace/OS.h :
+ Put #if !defined guards around the ACE_THR_PRI* macros
+ so that we can define them in the config*.h files if
+ they need to be corrected. For instance, ACE_THR_PRI_OTHER_MIN
+ has a different value on SunOS 5.8 than it does on SunOS 5.7,
+ i.e., -20 vs. 0 respectively.
+
+ Also, added some needed typedefs and #define for ACE_HAS_PACE
+ on VxWorks and updated some comments concerning ACE_OS::thr_create
+ flags.
+
+ * ace/Sched_Params.cpp (priority_min, priority_max):
+ Changed to return correct thread priority min/max for
+ Solaris threads. We now use the ACE_PRI_THR* macros
+ for these values while still calling ACE_OS::priority_control
+ for process and LWP priorities.
+
+ * ace/config-sunos5.8.h:
+ Added setting of ACE_THR_PRI_OTHER_MIN to be correct
+ for SunOS 5.8.
+
Tue Jul 24 13:47:32 2001 Balachandran Natarajan <bala@cs.wustl.edu>
* ace/SSL/SSL_Asynch_Stream.h (ACE_SSL_Asynch_Stream):
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 8f262c1e611..d9f429a1e66 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,36 @@
+Tue Jul 24 16:41:57 2001 Joe Hoffert <joeh@cs.wustl.edu>
+
+ * ace/Thread_Manager.cpp :
+ Added "&& ! defined (ACE_HAS_PACE)" ifdefs to already existing
+ #if defined (VXWORKS) sections of code to get ACE_HAS_PACE to
+ compile on VxWorks.
+
+ * ace/OS.i :
+ * ace/OS.cpp:
+ Fixed formatting of some comments and added needed PACE
+ calls for ACE_HAS_PACE on VxWorks.
+
+ * ace/OS.h :
+ Put #if !defined guards around the ACE_THR_PRI* macros
+ so that we can define them in the config*.h files if
+ they need to be corrected. For instance, ACE_THR_PRI_OTHER_MIN
+ has a different value on SunOS 5.8 than it does on SunOS 5.7,
+ i.e., -20 vs. 0 respectively.
+
+ Also, added some needed typedefs and #define for ACE_HAS_PACE
+ on VxWorks and updated some comments concerning ACE_OS::thr_create
+ flags.
+
+ * ace/Sched_Params.cpp (priority_min, priority_max):
+ Changed to return correct thread priority min/max for
+ Solaris threads. We now use the ACE_PRI_THR* macros
+ for these values while still calling ACE_OS::priority_control
+ for process and LWP priorities.
+
+ * ace/config-sunos5.8.h:
+ Added setting of ACE_THR_PRI_OTHER_MIN to be correct
+ for SunOS 5.8.
+
Tue Jul 24 13:47:32 2001 Balachandran Natarajan <bala@cs.wustl.edu>
* ace/SSL/SSL_Asynch_Stream.h (ACE_SSL_Asynch_Stream):
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 8f262c1e611..d9f429a1e66 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,36 @@
+Tue Jul 24 16:41:57 2001 Joe Hoffert <joeh@cs.wustl.edu>
+
+ * ace/Thread_Manager.cpp :
+ Added "&& ! defined (ACE_HAS_PACE)" ifdefs to already existing
+ #if defined (VXWORKS) sections of code to get ACE_HAS_PACE to
+ compile on VxWorks.
+
+ * ace/OS.i :
+ * ace/OS.cpp:
+ Fixed formatting of some comments and added needed PACE
+ calls for ACE_HAS_PACE on VxWorks.
+
+ * ace/OS.h :
+ Put #if !defined guards around the ACE_THR_PRI* macros
+ so that we can define them in the config*.h files if
+ they need to be corrected. For instance, ACE_THR_PRI_OTHER_MIN
+ has a different value on SunOS 5.8 than it does on SunOS 5.7,
+ i.e., -20 vs. 0 respectively.
+
+ Also, added some needed typedefs and #define for ACE_HAS_PACE
+ on VxWorks and updated some comments concerning ACE_OS::thr_create
+ flags.
+
+ * ace/Sched_Params.cpp (priority_min, priority_max):
+ Changed to return correct thread priority min/max for
+ Solaris threads. We now use the ACE_PRI_THR* macros
+ for these values while still calling ACE_OS::priority_control
+ for process and LWP priorities.
+
+ * ace/config-sunos5.8.h:
+ Added setting of ACE_THR_PRI_OTHER_MIN to be correct
+ for SunOS 5.8.
+
Tue Jul 24 13:47:32 2001 Balachandran Natarajan <bala@cs.wustl.edu>
* ace/SSL/SSL_Asynch_Stream.h (ACE_SSL_Asynch_Stream):
diff --git a/ace/OS.cpp b/ace/OS.cpp
index afaad3ef5a6..9b05b8161cd 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -967,7 +967,7 @@ void
ACE_OS::mutex_lock_cleanup (void *mutex)
{
ACE_OS_TRACE ("ACE_OS::mutex_lock_cleanup");
-#if defined (ACE_HAS_PACE) && !defined (ACE_WIN32)
+#if defined (ACE_HAS_PACE) && !defined (ACE_WIN32)
pace_pthread_mutex_t *p_lock = (pace_pthread_mutex_t *) mutex;
pace_pthread_mutex_unlock (p_lock);
# elif defined (ACE_HAS_THREADS)
@@ -979,7 +979,7 @@ ACE_OS::mutex_lock_cleanup (void *mutex)
# endif /* ACE_HAS_PTHREADS */
# else
ACE_UNUSED_ARG (mutex);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_WIN32 */
}
#if defined (ACE_HAS_WINCE)
@@ -1402,9 +1402,9 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
else if (sched_params.scope () == ACE_SCOPE_THREAD)
{
ACE_thread_t thr_id = ACE_OS::thr_self ();
- return pthread_setschedparam (thr_id,
- sched_params.policy (),
- &param);
+ return pace_pthread_setschedparam (thr_id,
+ sched_params.policy (),
+ &param);
}
#if defined (sun)
// We need to be able to set LWP priorities on Suns, even without
@@ -1555,7 +1555,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params,
ACE_UNUSED_ARG (sched_params);
ACE_UNUSED_ARG (id);
ACE_NOTSUP_RETURN (-1);
-#endif /* ACE_HAS_PACE */
+#endif /* ACE_HAS_PACE && !ACE_WIN32 */
}
// = Static initialization.
@@ -2554,7 +2554,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
if (thr_handle == 0)
thr_handle = &tmp_handle;
- int result;
+ int result = 0;
pace_pthread_attr_t attr;
if (::pace_pthread_attr_init (&attr) != 0)
return -1;
@@ -2678,19 +2678,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
{
pace_sched_param sparam;
ACE_OS::memset ((void *) &sparam, 0, sizeof sparam);
- // The following code forces priority into range.
- if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO))
- sparam.sched_priority =
- ACE_MIN (ACE_THR_PRI_FIFO_MAX,
- ACE_MAX (ACE_THR_PRI_FIFO_MIN, priority));
- else if (ACE_BIT_ENABLED(flags, THR_SCHED_RR))
- sparam.sched_priority =
- ACE_MIN (ACE_THR_PRI_RR_MAX,
- ACE_MAX (ACE_THR_PRI_RR_MIN, priority));
- else // Default policy, whether set or not
- sparam.sched_priority =
- ACE_MIN (ACE_THR_PRI_OTHER_MAX,
- ACE_MAX (ACE_THR_PRI_OTHER_MIN, priority));
+ sparam.sched_priority = priority;
# if defined (sun) && defined (ACE_HAS_ONLY_SCHED_OTHER)
// SunOS, through 5.6, POSIX only allows priorities > 0 to
// ::pthread_attr_setschedparam. If a priority of 0 was
@@ -2777,7 +2765,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
ACE_OSCALL (ACE_ADAPT_RETVAL (::pace_pthread_create (thr_id,
&attr,
- thread_args->entry_point (),
+ PACE_THR_ENTRY_CAST (void * (*)(void *)) thread_args->entry_point (),
thread_args),
result),
int, -1, result);
@@ -2840,7 +2828,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# endif /* sun && ACE_HAS_ONLY_SCHED_OTHER */
return result;
-#else /* ACE_HAS_PACE */
+#else /* ACE_HAS_PACE && !ACE_WIN32 */
ACE_Base_Thread_Adapter *thread_args;
if (thread_adapter == 0)
@@ -3666,7 +3654,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
ACE_UNUSED_ARG (stacksize);
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
-#endif /* ACE_HAS_PACE */
+#endif /* ACE_HAS_PACE && !ACE_WIN32 */
}
void
@@ -3743,7 +3731,7 @@ ACE_OS::thr_exit (void *status)
# endif /* ACE_HAS_PTHREADS */
# else
ACE_UNUSED_ARG (status);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_WIN32 */
}
int
@@ -3918,7 +3906,7 @@ ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data)
ACE_UNUSED_ARG (key);
ACE_UNUSED_ARG (data);
ACE_NOTSUP_RETURN (-1);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_HAS_TSS_EMULATION && !ACE_WIN32 */
}
int
@@ -3959,7 +3947,7 @@ ACE_OS::thr_keyfree (ACE_thread_key_t key)
# else
ACE_UNUSED_ARG (key);
ACE_NOTSUP_RETURN (-1);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_HAS_TSS_EMULATION && !ACE_WIN32 */
}
# if defined (ACE_HAS_TSS_EMULATION) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
@@ -4019,7 +4007,7 @@ ACE_OS::thr_keycreate (ACE_OS_thread_key_t *key,
ACE_UNUSED_ARG (dest);
ACE_UNUSED_ARG (inst);
ACE_NOTSUP_RETURN (-1);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_WIN32 */
}
# endif /* ACE_HAS_TSS_EMULATION && ACE_HAS_THREAD_SPECIFIC_STORAGE */
@@ -4119,7 +4107,7 @@ ACE_OS::thr_keycreate (ACE_thread_key_t *key,
ACE_UNUSED_ARG (dest);
ACE_UNUSED_ARG (inst);
ACE_NOTSUP_RETURN (-1);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_HAS_TSS_EMULATION && !ACE_WIN32 */
}
int
@@ -4830,7 +4818,7 @@ siginfo_t::siginfo_t (ACE_HANDLE *handles)
si_handles_ (handles)
{
}
-# endif /* ! (ACE_HAS_PACE && ACE_WIN32) */
+# endif /* ! ACE_HAS_PACE || ! ACE_WIN32 */
# endif /* ACE_HAS_SIGINFO_T */
pid_t
@@ -5742,7 +5730,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
}
# endif /* ! ACE_HAS_THREADS || ACE_LACKS_RWLOCK_T */
-#if defined (ACE_LACKS_COND_T) && ! defined (ACE_PSOS_DIAB_MIPS)
+#if defined (ACE_LACKS_COND_T) && ! defined (ACE_PSOS_DIAB_MIPS) && ! (defined (ACE_HAS_PACE) && ! defined (ACE_HAS_WIN32))
// NOTE: The ACE_OS::cond_* functions for some non-Unix platforms are
// defined here either because they're too big to be inlined, or
// to avoid use before definition if they were inline.
@@ -5936,7 +5924,9 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
ACE_mutex_t *external_mutex)
{
ACE_OS_TRACE ("ACE_OS::cond_wait");
-# if defined (ACE_HAS_THREADS)
+# if defined (ACE_HAS_PACE) && !defined (ACE_WIN32)
+ return (::pace_pthread_cond_wait(cv, external_mutex);
+# elif defined (ACE_HAS_THREADS)
// Prevent race conditions on the <waiters_> count.
ACE_OS::thread_mutex_lock (&cv->waiters_lock_);
cv->waiters_++;
@@ -5957,7 +5947,7 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
cv->sema_, INFINITE, FALSE),
result),
int, -1, result);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_WIN32 */
else
# endif /* ACE_HAS_SIGNAL_OBJECT_AND_WAIT */
{
@@ -6038,7 +6028,9 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_Time_Value *timeout)
{
ACE_OS_TRACE ("ACE_OS::cond_timedwait");
-# if defined (ACE_HAS_THREADS)
+# if defined (ACE_HAS_PACE) && !defined (ACE_WIN32)
+ return (::pace_pthread_cond_timedwait(cv, external_mutex, timeout);
+# elif defined (ACE_HAS_THREADS)
// Handle the easy case first.
if (timeout == 0)
return ACE_OS::cond_wait (cv, external_mutex);
@@ -6084,7 +6076,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
cv->sema_,
msec_timeout,
FALSE);
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_WIN32 */
else
# endif /* ACE_HAS_SIGNAL_OBJECT_AND_WAIT */
{
diff --git a/ace/OS.h b/ace/OS.h
index 8fd296c5611..24cf39c71d2 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -14,6 +14,7 @@
#ifndef ACE_OS_H
#define ACE_OS_H
+
#include "ace/pre.h"
#include "ace/config-all.h"
@@ -1837,7 +1838,7 @@ typedef const struct rlimit ACE_SETRLIMIT_TYPE;
ACE_Read_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) return RETURN;
-#if defined (ACE_HAS_PACE) && !defined (ACE_WIN32)
+# if defined (ACE_HAS_PACE) && !defined (ACE_WIN32)
# include /**/ "pace/semaphore.h"
# if !defined (SEM_FAILED)
# define SEM_FAILED ((pace_sem_t *) -1)
@@ -1879,7 +1880,7 @@ typedef struct
// remember if we need to delete <sema_> or not.
#endif /* ACE_LACKS_NAMED_POSIX_SEM */
} ACE_sema_t;
-# endif /* ACE_HAS_PACE */
+# endif /* ACE_HAS_PACE && !ACE_WIN32 */
struct cancel_state
{
@@ -2062,42 +2063,86 @@ struct stat
// THREAD-level values
# if defined(PRI_FIFO_MIN) && defined(PRI_FIFO_MAX) && defined(PRI_RR_MIN) && defined(PRI_RR_MAX) && defined(PRI_OTHER_MIN) && defined(PRI_OTHER_MAX)
-# define ACE_THR_PRI_FIFO_MIN (long) PRI_FIFO_MIN
-# define ACE_THR_PRI_FIFO_MAX (long) PRI_FIFO_MAX
-# define ACE_THR_PRI_RR_MIN (long) PRI_RR_MIN
-# define ACE_THR_PRI_RR_MAX (long) PRI_RR_MAX
-# define ACE_THR_PRI_OTHER_MIN (long) PRI_OTHER_MIN
-# define ACE_THR_PRI_OTHER_MAX (long) PRI_OTHER_MAX
+# if !defined (ACE_THR_PRI_FIFO_MIN)
+# define ACE_THR_PRI_FIFO_MIN (long) PRI_FIFO_MIN
+# endif /* !ACE_THR_PRI_FIFO_MIN */
+# if !defined (ACE_THR_PRI_FIFO_MAX)
+# define ACE_THR_PRI_FIFO_MAX (long) PRI_FIFO_MAX
+# endif /* !ACE_THR_PRI_FIFO_MAX */
+# if !defined (ACE_THR_PRI_RR_MIN)
+# define ACE_THR_PRI_RR_MIN (long) PRI_RR_MIN
+# endif /* !ACE_THR_PRI_RR_MIN */
+# if !defined (ACE_THR_PRI_RR_MAX)
+# define ACE_THR_PRI_RR_MAX (long) PRI_RR_MAX
+# endif /* !ACE_THR_PRI_RR_MAX */
+# if !defined (ACE_THR_PRI_OTHER_MIN)
+# define ACE_THR_PRI_OTHER_MIN (long) PRI_OTHER_MIN
+# endif /* !ACE_THR_PRI_OTHER_MIN */
+# if !defined (ACE_THR_PRI_OTHER_MAX)
+# define ACE_THR_PRI_OTHER_MAX (long) PRI_OTHER_MAX
+# endif /* !ACE_THR_PRI_OTHER_MAX */
# elif defined (AIX)
// AIX's priority range is 1 (low) to 127 (high). There aren't
// any preprocessor macros I can find. PRIORITY_MIN is for
// process priorities, as far as I can see, and does not apply
// to thread priority. The 1 to 127 range is from the
// pthread_attr_setschedparam man page (Steve Huston, 18-May-2001).
-# define ACE_THR_PRI_FIFO_MIN (long) 1
-# define ACE_THR_PRI_FIFO_MAX (long) 127
-# define ACE_THR_PRI_RR_MIN (long) 1
-# define ACE_THR_PRI_RR_MAX (long) 127
-# define ACE_THR_PRI_OTHER_MIN (long) 1
-# define ACE_THR_PRI_OTHER_MAX (long) 127
+# if !defined (ACE_THR_PRI_FIFO_MIN)
+# define ACE_THR_PRI_FIFO_MIN (long) 1
+# endif /* !ACE_THR_PRI_FIFO_MIN */
+# if !defined (ACE_THR_PRI_FIFO_MAX)
+# define ACE_THR_PRI_FIFO_MAX (long) 127
+# endif /* !ACE_THR_PRI_FIFO_MAX */
+# if !defined (ACE_THR_PRI_RR_MIN)
+# define ACE_THR_PRI_RR_MIN (long) 1
+# endif /* !ACE_THR_PRI_RR_MIN */
+# if !defined (ACE_THR_PRI_RR_MAX)
+# define ACE_THR_PRI_RR_MAX (long) 127
+# endif /* !ACE_THR_PRI_RR_MAX */
+# if !defined (ACE_THR_PRI_OTHER_MIN)
+# define ACE_THR_PRI_OTHER_MIN (long) 1
+# endif /* !ACE_THR_PRI_OTHER_MIN */
+# if !defined (ACE_THR_PRI_OTHER_MAX)
+# define ACE_THR_PRI_OTHER_MAX (long) 127
+# endif /* !ACE_THR_PRI_OTHER_MAX */
# elif defined (sun)
- // SunOS 5.6 could use sched_get_priority_min/max () for FIFO
- // and RR. But for OTHER, it returns negative values, which
- // can't be used. sched_get_priority_min/max () aren't
- // supported in SunOS 5.5.1.
-# define ACE_THR_PRI_FIFO_MIN (long) 0
-# define ACE_THR_PRI_FIFO_MAX (long) 59
-# define ACE_THR_PRI_RR_MIN (long) 0
-# define ACE_THR_PRI_RR_MAX (long) 59
-# define ACE_THR_PRI_OTHER_MIN (long) 0
-# define ACE_THR_PRI_OTHER_MAX (long) 59
+# if !defined (ACE_THR_PRI_FIFO_MIN)
+# define ACE_THR_PRI_FIFO_MIN (long) 0
+# endif /* !ACE_THR_PRI_FIFO_MIN */
+# if !defined (ACE_THR_PRI_FIFO_MAX)
+# define ACE_THR_PRI_FIFO_MAX (long) 59
+# endif /* !ACE_THR_PRI_FIFO_MAX */
+# if !defined (ACE_THR_PRI_RR_MIN)
+# define ACE_THR_PRI_RR_MIN (long) 0
+# endif /* !ACE_THR_PRI_RR_MIN */
+# if !defined (ACE_THR_PRI_RR_MAX)
+# define ACE_THR_PRI_RR_MAX (long) 59
+# endif /* !ACE_THR_PRI_RR_MAX */
+# if !defined (ACE_THR_PRI_OTHER_MIN)
+# define ACE_THR_PRI_OTHER_MIN (long) 0
+# endif /* !ACE_THR_PRI_OTHER_MIN */
+# if !defined (ACE_THR_PRI_OTHER_MAX)
+# define ACE_THR_PRI_OTHER_MAX (long) 127
+# endif /* !ACE_THR_PRI_OTHER_MAX */
# else
-# define ACE_THR_PRI_FIFO_MIN (long) ACE_PROC_PRI_FIFO_MIN
-# define ACE_THR_PRI_FIFO_MAX (long) ACE_PROC_PRI_FIFO_MAX
-# define ACE_THR_PRI_RR_MIN (long) ACE_PROC_PRI_RR_MIN
-# define ACE_THR_PRI_RR_MAX (long) ACE_PROC_PRI_RR_MAX
-# define ACE_THR_PRI_OTHER_MIN (long) ACE_PROC_PRI_OTHER_MIN
-# define ACE_THR_PRI_OTHER_MAX (long) ACE_PROC_PRI_OTHER_MAX
+# if !defined (ACE_THR_PRI_FIFO_MIN)
+# define ACE_THR_PRI_FIFO_MIN (long) ACE_PROC_PRI_FIFO_MIN
+# endif /* !ACE_THR_PRI_FIFO_MIN */
+# if !defined (ACE_THR_PRI_FIFO_MAX)
+# define ACE_THR_PRI_FIFO_MAX (long) ACE_PROC_PRI_FIFO_MAX
+# endif /* !ACE_THR_PRI_FIFO_MAX */
+# if !defined (ACE_THR_PRI_RR_MIN)
+# define ACE_THR_PRI_RR_MIN (long) ACE_PROC_PRI_RR_MIN
+# endif /* !ACE_THR_PRI_RR_MIN */
+# if !defined (ACE_THR_PRI_RR_MAX)
+# define ACE_THR_PRI_RR_MAX (long) ACE_PROC_PRI_RR_MAX
+# endif /* !ACE_THR_PRI_RR_MAX */
+# if !defined (ACE_THR_PRI_OTHER_MIN)
+# define ACE_THR_PRI_OTHER_MIN (long) ACE_PROC_PRI_OTHER_MIN
+# endif /* !ACE_THR_PRI_OTHER_MIN */
+# if !defined (ACE_THR_PRI_OTHER_MAX)
+# define ACE_THR_PRI_OTHER_MAX (long) ACE_PROC_PRI_OTHER_MAX
+# endif /* !ACE_THR_PRI_OTHER_MAX */
# endif
# if !defined(ACE_THR_PRI_FIFO_DEF)
# define ACE_THR_PRI_FIFO_DEF ((ACE_THR_PRI_FIFO_MIN + ACE_THR_PRI_FIFO_MAX)/2)
@@ -2437,6 +2482,37 @@ struct sockaddr_un {
# define USYNC_THREAD 0
# define USYNC_PROCESS 1 /* It's all global on VxWorks
(without MMU option). */
+# if defined (ACE_HAS_PACE)
+# define THR_INHERIT_SCHED 0
+# define THR_EXPLICIT_SCHED 0
+# define THR_SCHED_IO 0
+# define ACE_PROC_PRI_FIFO_MIN (sched_get_priority_min(SCHED_FIFO))
+# define ACE_PROC_PRI_FIFO_MAX (sched_get_priority_max(SCHED_FIFO))
+# define ACE_PROC_PRI_RR_MIN (sched_get_priority_min(SCHED_RR))
+# define ACE_PROC_PRI_RR_MAX (sched_get_priority_max(SCHED_RR))
+# define ACE_PROC_PRI_OTHER_MIN (sched_get_priority_min(SCHED_OTHER))
+# define ACE_PROC_PRI_OTHER_MAX (sched_get_priority_max(SCHED_OTHER))
+# if !defined (ACE_THR_PRI_FIFO_MIN)
+# define ACE_THR_PRI_FIFO_MIN (long) ACE_PROC_PRI_FIFO_MIN
+# endif /* !ACE_THR_PRI_FIFO_MIN */
+# if !defined (ACE_THR_PRI_FIFO_MAX)
+# define ACE_THR_PRI_FIFO_MAX (long) ACE_PROC_PRI_FIFO_MAX
+# endif /* !ACE_THR_PRI_FIFO_MAX */
+# if !defined (ACE_THR_PRI_RR_MIN)
+# define ACE_THR_PRI_RR_MIN (long) ACE_PROC_PRI_RR_MIN
+# endif /* !ACE_THR_PRI_RR_MIN */
+# if !defined (ACE_THR_PRI_RR_MAX)
+# define ACE_THR_PRI_RR_MAX (long) ACE_PROC_PRI_RR_MAX
+# endif /* !ACE_THR_PRI_RR_MAX */
+# if !defined (ACE_THR_PRI_OTHER_MIN)
+# define ACE_THR_PRI_OTHER_MIN (long) ACE_PROC_PRI_OTHER_MIN
+# endif /* !ACE_THR_PRI_OTHER_MIN */
+# if !defined (ACE_THR_PRI_OTHER_MAX)
+# define ACE_THR_PRI_OTHER_MAX (long) ACE_PROC_PRI_OTHER_MAX
+# endif /* !ACE_THR_PRI_OTHER_MAX */
+# define THR_SCOPE_SYSTEM 0
+# define THR_SCOPE_PROCESS 0
+# endif /* ACE_HAS_PACE */
# if !defined (ACE_DEFAULT_SYNCH_TYPE)
// Types include these options: SEM_Q_PRIORITY, SEM_Q_FIFO,
@@ -2445,7 +2521,14 @@ struct sockaddr_un {
# define ACE_DEFAULT_SYNCH_TYPE SEM_Q_FIFO
# endif /* ! ACE_DEFAULT_SYNCH_TYPE */
+# if defined (ACE_HAS_PACE)
+typedef pace_pthread_mutex_t ACE_mutex_t;
+typedef pace_pthread_mutexattr_t ACE_mutexattr_t;
+typedef pace_pthread_cond_t ACE_cond_t;
+typedef pace_pthread_condattr_t ACE_condattr_t;
+# else
typedef SEM_ID ACE_mutex_t;
+# endif /* ACE_HAS_PACE */
// Implement ACE_thread_mutex_t with ACE_mutex_t because there's just
// one process . . .
typedef ACE_mutex_t ACE_thread_mutex_t;
@@ -2453,15 +2536,24 @@ typedef ACE_mutex_t ACE_thread_mutex_t;
// Use VxWorks semaphores, wrapped ...
typedef struct
{
+# if defined (ACE_HAS_PACE)
+ pace_pthread_mutex_t sema_;
+# else
SEM_ID sema_;
+# endif /* ACE_HAS_PACE */
// Semaphore handle. This is allocated by VxWorks.
char *name_;
// Name of the semaphore: always NULL with VxWorks.
} ACE_sema_t;
# endif /* !ACE_HAS_POSIX_SEM */
+# if defined (ACE_HAS_PACE)
+typedef pace_pthread_t ACE_thread_t;
+typedef pace_pthread_t ACE_hthread_t;
+# else
typedef char * ACE_thread_t;
typedef int ACE_hthread_t;
+# endif /* ACE_HAS_PACE */
// Key type: the ACE TSS emulation requires the key type be unsigned,
// for efficiency. (Current POSIX and Solaris TSS implementations also
// use u_int, so the ACE TSS emulation is compatible with them.)
@@ -2543,7 +2635,7 @@ public:
# define THR_SCHED_DEFAULT 0
# endif /* ACE_HAS_PTHREADS / STHREADS / PSOS / VXWORKS / WTHREADS */
-# if defined (ACE_LACKS_COND_T)
+# if defined (ACE_LACKS_COND_T) && !defined (ACE_HAS_PACE)
/**
* @class ACE_cond_t
*
@@ -6492,7 +6584,8 @@ public:
* THR_CANCEL_DISABLE, THR_CANCEL_ENABLE, THR_CANCEL_DEFERRED,
* THR_CANCEL_ASYNCHRONOUS, THR_BOUND, THR_NEW_LWP, THR_DETACHED,
* THR_SUSPENDED, THR_DAEMON, THR_JOINABLE, THR_SCHED_FIFO,
- * THR_SCHED_RR, THR_SCHED_DEFAULT
+ * THR_SCHED_RR, THR_SCHED_DEFAULT, THR_EXPLICIT_SCHED,
+ * THR_SCOPE_SYSTEM
* = END<INDENT>
*
* By default, or if <priority> is set to
diff --git a/ace/OS.i b/ace/OS.i
index f3ef088565b..c85705ee137 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -1476,7 +1476,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
{
// ACE_OS_TRACE ("ACE_OS::mutex_init");
#if defined (ACE_HAS_PACE) && !defined (ACE_WIN32)
- pthread_mutexattr_t l_attributes;
+ pace_pthread_mutexattr_t l_attributes;
if (attributes == 0)
attributes = &l_attributes;
int result = 0;
@@ -2368,7 +2368,7 @@ ACE_OS::thread_mutex_unlock (ACE_thread_mutex_t *m)
#endif /* ACE_HAS_THREADS */
}
-#if !defined (ACE_LACKS_COND_T)
+#if !defined (ACE_LACKS_COND_T) || (defined (ACE_HAS_PACE) && ! defined (ACE_HAS_WIN32))
// NOTE: The ACE_OS::cond_* functions for Unix platforms are defined
// here because the ACE_OS::sema_* functions below need them.
// However, ACE_WIN32 and VXWORKS define the ACE_OS::cond_* functions
@@ -2682,7 +2682,8 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_Time_Value *timeout)
{
ACE_OS_TRACE ("ACE_OS::cond_timedwait");
-#if (0)
+ //#if defined (ACE_HAS_PACE)
+#if 0
int result;
timespec_t ts;
@@ -2691,7 +2692,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_OSCALL (ACE_ADAPT_RETVAL (timeout == 0
? (::pace_pthread_cond_wait (cv, external_mutex))
: (::pace_pthread_cond_timedwait (cv, external_mutex, (ACE_TIMESPEC_PTR) &ts),
- int, -1, result);
+ int, -1, result)));
// We need to adjust this to make the POSIX and Solaris return
// values consistent. EAGAIN is from Pthreads DRAFT4 (HP-UX 10.20 and
@@ -7468,7 +7469,14 @@ ACE_OS::thr_continue (ACE_hthread_t target_thread)
# elif defined (ACE_PSOS)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::t_resume (target_thread), ace_result_), int, -1);
# elif defined (VXWORKS)
+# if defined (ACE_HAS_PACE)
+ // pthread_continue (like pthread_suspend) is not an official POSIX
+ // function. We get this for free with ACE. So use the thread ID from
+ // the pace_pthread_t structure.
+ ACE_OSCALL_RETURN (::taskResume (target_thread->tid), int, -1);
+# else
ACE_OSCALL_RETURN (::taskResume (target_thread), int, -1);
+# endif /* ACE_HAS_PACE */
# endif /* ACE_HAS_STHREADS */
#else
ACE_UNUSED_ARG (target_thread);
@@ -8333,9 +8341,17 @@ ACE_OS::thr_min_stack (void)
ACE_hthread_t tid;
ACE_OS::thr_self (tid);
+# if defined (ACE_HAS_PACE)
+ // pthread_min_stack is not a POSIX function. So use the thread ID from
+ // the pace_pthread_t structure.
+ ACE_OSCALL (ACE_ADAPT_RETVAL (::taskInfoGet (tid->tid, &taskDesc),
+ status),
+ STATUS, -1, status);
+# else
ACE_OSCALL (ACE_ADAPT_RETVAL (::taskInfoGet (tid, &taskDesc),
status),
STATUS, -1, status);
+# endif /* ACE_HAS_PACE */
return status == OK ? taskDesc.td_stackSize : 0;
# else /* Should not happen... */
ACE_NOTSUP_RETURN (0);
@@ -8474,7 +8490,14 @@ ACE_OS::thr_suspend (ACE_hthread_t target_thread)
# elif defined (ACE_PSOS)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::t_suspend (target_thread), ace_result_), int, -1);
# elif defined (VXWORKS)
+# if defined (ACE_HAS_PACE)
+ // pthread_suspend (like pthread_continue) is not an official POSIX
+ // function. We get this for free with ACE. So use the thread ID from
+ // the pace_pthread_t structure.
+ ACE_OSCALL_RETURN (::taskSuspend (target_thread->tid), int, -1);
+# else
ACE_OSCALL_RETURN (::taskSuspend (target_thread), int, -1);
+# endif /* ACE_HAS_PACE */
# endif /* ACE_HAS_STHREADS */
#else
ACE_UNUSED_ARG (target_thread);
@@ -11626,13 +11649,13 @@ ACE_OS::wsncmp (const WChar *s, const WChar *t, size_t len)
return len == 0 ? 0 : *scan1 - *scan2;
}
-#if defined (ACE_LACKS_COND_T) && defined (ACE_HAS_THREADS)
+#if defined (ACE_LACKS_COND_T) && defined (ACE_HAS_THREADS) && ! defined (ACE_HAS_PACE)
ACE_INLINE long
ACE_cond_t::waiters (void) const
{
return this->waiters_;
}
-#endif /* ACE_LACKS_COND_T && ACE_HAS_THREADS */
+#endif /* ACE_LACKS_COND_T && ACE_HAS_THREADS && ! ACE_HAS_PACE */
#if 0
ACE_INLINE int
diff --git a/ace/Sched_Params.cpp b/ace/Sched_Params.cpp
index e590119681c..0dd45f79fd1 100644
--- a/ace/Sched_Params.cpp
+++ b/ace/Sched_Params.cpp
@@ -34,32 +34,54 @@ ACE_Sched_Params::priority_min (const Policy policy,
// Assume that ACE_SCHED_OTHER indicates TS class, and that other
// policies indicate RT class.
- if (policy == ACE_SCHED_OTHER)
+ // Call ACE_OS::priority_control only for processes (lightweight
+ // or otherwise). Calling ACE_OS::priority_control for thread
+ // priorities gives incorrect results.
+ if (scope == ACE_SCOPE_PROCESS || scope == ACE_SCOPE_LWP)
{
- // Get the priority class ID and attributes.
- pcinfo_t pcinfo;
- // The following is just to avoid Purify warnings about unitialized
- // memory reads.
- ACE_OS::memset (&pcinfo, 0, sizeof pcinfo);
- ACE_OS::strcpy (pcinfo.pc_clname, "TS");
+ if (policy == ACE_SCHED_OTHER)
+ {
+ // Get the priority class ID and attributes.
+ pcinfo_t pcinfo;
+ // The following is just to avoid Purify warnings about unitialized
+ // memory reads.
+ ACE_OS::memset (&pcinfo, 0, sizeof pcinfo);
+ ACE_OS::strcpy (pcinfo.pc_clname, "TS");
- if (ACE_OS::priority_control (P_ALL /* ignored */,
- P_MYID /* ignored */,
- PC_GETCID,
- (char *) &pcinfo) == -1)
- // Just hope that priority range wasn't configured from -1
- // .. 1
- return -1;
+ if (ACE_OS::priority_control (P_ALL /* ignored */,
+ P_MYID /* ignored */,
+ PC_GETCID,
+ (char *) &pcinfo) == -1)
+ // Just hope that priority range wasn't configured from -1
+ // .. 1
+ return -1;
- // OK, now we've got the class ID in pcinfo.pc_cid. In
- // addition, the maximum configured time-share priority is in
- // ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri. The minimum
- // priority is just the negative of that.
+ // OK, now we've got the class ID in pcinfo.pc_cid. In
+ // addition, the maximum configured time-share priority is in
+ // ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri. The minimum
+ // priority is just the negative of that.
- return -((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri;
+ return -((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri;
+ }
+ else
+ return 0;
}
else
- return 0;
+ {
+ // Here we handle the case for ACE_SCOPE_THREAD. Calling
+ // ACE_OS::priority_control for thread scope gives incorrect
+ // results.
+ switch (policy)
+ {
+ case ACE_SCHED_FIFO:
+ return ACE_THR_PRI_FIFO_MIN;
+ case ACE_SCHED_RR:
+ return ACE_THR_PRI_RR_MIN;
+ case ACE_SCHED_OTHER:
+ default:
+ return ACE_THR_PRI_OTHER_MIN;
+ }
+ }
#elif defined (ACE_HAS_PTHREADS) && !defined(ACE_LACKS_SETSCHED)
switch (scope)
@@ -116,30 +138,52 @@ ACE_Sched_Params::priority_max (const Policy policy,
#if defined (ACE_HAS_PRIOCNTL) && defined (ACE_HAS_STHREADS)
ACE_UNUSED_ARG (scope);
- // Assume that ACE_SCHED_OTHER indicates TS class, and that other
- // policies indicate RT class.
+ // Call ACE_OS::priority_control only for processes (lightweight
+ // or otherwise). Calling ACE_OS::priority_control for thread
+ // priorities gives incorrect results.
+ if (scope == ACE_SCOPE_PROCESS || scope == ACE_SCOPE_LWP)
+ {
+ // Assume that ACE_SCHED_OTHER indicates TS class, and that other
+ // policies indicate RT class.
- // Get the priority class ID and attributes.
- pcinfo_t pcinfo;
- // The following is just to avoid Purify warnings about unitialized
- // memory reads.
- ACE_OS::memset (&pcinfo, 0, sizeof pcinfo);
- ACE_OS::strcpy (pcinfo.pc_clname,
- policy == ACE_SCHED_OTHER ? "TS" : "RT");
+ // Get the priority class ID and attributes.
+ pcinfo_t pcinfo;
+ // The following is just to avoid Purify warnings about unitialized
+ // memory reads.
+ ACE_OS::memset (&pcinfo, 0, sizeof pcinfo);
+ ACE_OS::strcpy (pcinfo.pc_clname,
+ policy == ACE_SCHED_OTHER ? "TS" : "RT");
- if (ACE_OS::priority_control (P_ALL /* ignored */,
- P_MYID /* ignored */,
- PC_GETCID,
- (char *) &pcinfo) == -1)
- return -1;
+ if (ACE_OS::priority_control (P_ALL /* ignored */,
+ P_MYID /* ignored */,
+ PC_GETCID,
+ (char *) &pcinfo) == -1)
+ return -1;
- // OK, now we've got the class ID in pcinfo.pc_cid. In addition,
- // the maximum configured real-time priority is in ((rtinfo_t *)
- // pcinfo.pc_clinfo)->rt_maxpri, or similarly for the TS class.
+ // OK, now we've got the class ID in pcinfo.pc_cid. In addition,
+ // the maximum configured real-time priority is in ((rtinfo_t *)
+ // pcinfo.pc_clinfo)->rt_maxpri, or similarly for the TS class.
- return policy == ACE_SCHED_OTHER
- ? ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri
- : ((rtinfo_t *) pcinfo.pc_clinfo)->rt_maxpri;
+ return policy == ACE_SCHED_OTHER
+ ? ((tsinfo_t *) pcinfo.pc_clinfo)->ts_maxupri
+ : ((rtinfo_t *) pcinfo.pc_clinfo)->rt_maxpri;
+ }
+ else
+ {
+ // Here we handle the case for ACE_SCOPE_THREAD. Calling
+ // ACE_OS::priority_control for thread scope gives incorrect
+ // results.
+ switch (policy)
+ {
+ case ACE_SCHED_FIFO:
+ return ACE_THR_PRI_FIFO_MAX;
+ case ACE_SCHED_RR:
+ return ACE_THR_PRI_RR_MAX;
+ case ACE_SCHED_OTHER:
+ default:
+ return ACE_THR_PRI_OTHER_MAX;
+ }
+ }
#elif defined(ACE_HAS_PTHREADS) && !defined(ACE_LACKS_SETSCHED)
switch (scope)
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index e1035372ebe..e1d98517035 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -538,7 +538,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
ACE_TRACE ("ACE_Thread_Manager::spawn_i");
ACE_hthread_t thr_handle;
-#if defined (VXWORKS)
+#if defined (VXWORKS) && ! defined (ACE_HAS_PACE)
// On VxWorks, ACE_thread_t is char *. If t_id is 0, allocate space
// for ACE_OS::thr_create () to store the task name. If t_id is not
// 0, and it doesn't point to a 0 char *, then the non-zero char *
@@ -880,7 +880,7 @@ ACE_Thread_Manager::remove_thr (ACE_Thread_Descriptor *td,
#endif /* !ACE_USE_ONE_SHOT_AT_THREAD_EXIT */
this->thr_list_.remove (td);
-#if defined (VXWORKS)
+#if defined (VXWORKS) && ! defined (ACE_HAS_PACE)
// Delete the thread ID, if the ACE_Thread_Manager allocated it.
if (tid && tid[0] == ACE_THR_ID_ALLOCATED)
{
@@ -1022,7 +1022,7 @@ ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum)
ACE_TRACE ("ACE_Thread_Manager::kill_thr");
ACE_thread_t tid = td->thr_id_;
-#if defined (VXWORKS)
+#if defined (VXWORKS) && ! defined (ACE_HAS_PACE)
// Skip over the ID-allocated marker, if present.
tid += tid[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
#endif /* VXWORKS */
diff --git a/ace/config-sunos5.8.h b/ace/config-sunos5.8.h
index fd5c0054691..de6803e9822 100644
--- a/ace/config-sunos5.8.h
+++ b/ace/config-sunos5.8.h
@@ -9,13 +9,17 @@
// ACE_CONFIG_H is defined by one of the following #included headers.
// #include the SunOS 5.7 config, then add any SunOS 5.8 updates below.
-
#include "ace/config-sunos5.7.h"
+// The range of thread priorities for 5.8 differs from 5.7 in the
+// minimum priority for the SCHED_OTHER policy (i.e.,
+// ACE_THR_PRI_OTHER_MIN)
+# define ACE_THR_PRI_OTHER_MIN (long) -20
+
# if defined (_POSIX_PTHREAD_SEMANTICS)
-#ifdef ACE_LACKS_RWLOCK_T
-#undef ACE_LACKS_RWLOCK_T
-#endif /* ACE_LACKS_RWLOCK_T */
-#endif /* _POSIX_PTHREAD_SEMANTICS */
+# ifdef ACE_LACKS_RWLOCK_T
+# undef ACE_LACKS_RWLOCK_T
+# endif /* ACE_LACKS_RWLOCK_T */
+# endif /* _POSIX_PTHREAD_SEMANTICS */
#endif /* ACE_CONFIG_H */