summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-13 19:26:14 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-13 19:26:14 +0000
commit9c60a258ea59a1438cd1eae39ece12f88f318697 (patch)
tree90b358c4d4f44f3780e1aaa610c97e60865322d7 /ace
parentc34e71b95823eeede25aeeaa3b2d50c3736f5953 (diff)
downloadATCD-9c60a258ea59a1438cd1eae39ece12f88f318697.tar.gz
use ACE_DEFAULT_THREAD_PRIORITY instead of -1, because -1 is a valid priority on Win32
Diffstat (limited to 'ace')
-rw-r--r--ace/OS.cpp17
-rw-r--r--ace/OS.h9
-rw-r--r--ace/Task.h5
-rw-r--r--ace/Thread.h9
-rw-r--r--ace/Thread_Manager.h8
5 files changed, 27 insertions, 21 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 5d220b87cc5..855abe60a7a 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -1342,7 +1342,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# if !defined (ACE_LACKS_SETSCHED)
// If we wish to set the priority explicitly, we have to enable
// explicit scheduling, and a policy, too.
- if (priority != -1)
+ if (priority != ACE_DEFAULT_THREAD_PRIORITY)
{
ACE_SET_BITS (flags, THR_EXPLICIT_SCHED);
if (ACE_BIT_DISABLED (flags, THR_SCHED_FIFO)
@@ -1419,7 +1419,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
if ((ACE_BIT_ENABLED (flags, THR_SCHED_FIFO)
|| ACE_BIT_ENABLED (flags, THR_SCHED_RR)
|| ACE_BIT_ENABLED (flags, THR_SCHED_DEFAULT))
- && priority == -1)
+ && priority == ACE_DEFAULT_THREAD_PRIORITY)
{
if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO))
priority = ACE_THR_PRI_FIFO_DEF;
@@ -1429,7 +1429,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
priority = ACE_THR_PRI_OTHER_DEF;
}
# endif //ACE_HAS_PTHREADS_1003_DOT_1C
- if (priority != -1)
+ if (priority != ACE_DEFAULT_THREAD_PRIORITY)
{
struct sched_param sparam;
@@ -1562,6 +1562,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# endif /* ACE_HAS_THR_C_FUNC */
::pthread_attr_destroy (&attr);
# endif /* ACE_HAS_SETKIND_NP */
+
# if defined (ACE_HAS_STHREADS)
// This is the Solaris implementation of pthreads, where
// ACE_thread_t and ACE_hthread_t are the same.
@@ -1575,7 +1576,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
int result;
int start_suspended = ACE_BIT_ENABLED (flags, THR_SUSPENDED);
- if (priority >= 0)
+ if (priority != ACE_DEFAULT_THREAD_PRIORITY)
// If we need to set the priority, then we need to start the
// thread in a suspended mode.
ACE_SET_BITS (flags, THR_SUSPENDED);
@@ -1586,7 +1587,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
if (result != -1)
{
- if (priority >= 0)
+ if (priority != ACE_DEFAULT_THREAD_PRIORITY)
{
// Set the priority of the new thread and then let it
// continue, but only if the user didn't start it suspended
@@ -1632,7 +1633,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
{
int start_suspended = ACE_BIT_ENABLED (flags, THR_SUSPENDED);
- if (priority >= 0)
+ if (priority != ACE_DEFAULT_THREAD_PRIORITY)
// If we need to set the priority, then we need to start the
// thread in a suspended mode.
ACE_SET_BITS (flags, THR_SUSPENDED);
@@ -1645,7 +1646,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
flags,
(unsigned int *) thr_id);
- if (priority >= 0 && *thr_handle != 0)
+ if (priority != ACE_DEFAULT_THREAD_PRIORITY && *thr_handle != 0)
{
// Set the priority of the new thread and then let it
// continue, but only if the user didn't start it suspended
@@ -1689,7 +1690,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
// an even integer.
// If called with thr_create() defaults, use same default values as ::sp ():
- if (priority == -1) priority = 100;
+ if (priority == ACE_DEFAULT_THREAD_PRIORITY) priority = 100;
if (flags == 0) flags = VX_FP_TASK; // Assumes that there is a
// floating point coprocessor.
// As noted above, ::sp () hardcodes
diff --git a/ace/OS.h b/ace/OS.h
index 8b7eab56b78..4f049d3163f 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -852,6 +852,8 @@ enum ACE_Thread_State
// been reclaimed yet.
};
+#define ACE_DEFAULT_THREAD_PRIORITY (-0x7fffffffL-1L)
+
// Convenient macro for testing for deadlock, as well as for detecting
// when mutexes fail.
#define ACE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \
@@ -3043,7 +3045,7 @@ public:
void *args,
long flags,
ACE_Thread_ID *,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
void *stack = 0,
size_t stacksize = 0);
static int thr_getprio (ACE_Thread_ID thr_id, int &prio, int *policy = 0);
@@ -3063,7 +3065,7 @@ public:
long flags,
ACE_thread_t *thr_id,
ACE_hthread_t *t_handle = 0,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
void *stack = 0,
size_t stacksize = 0);
// Creates a new thread having <{flags}> attributes and running <{ACE_THR_FUNC}>
@@ -3077,7 +3079,8 @@ public:
// THR_SCHED_FIFO, THR_SCHED_RR, THR_SCHED_DEFAULT
// = END<INDENT>
//
- // By default, or if <{priority}> is set to -1, an "appropriate"
+ // By default, or if <{priority}> is set to ACE_DEFAULT_THREAD_PRIORITY,
+ // an "appropriate"
// priority value for the given scheduling policy (specified in
// <{flags}>, e.g., <THR_SCHED_DEFAULT>) is used. This value is
// calculated dynamically, and is the median value between the
diff --git a/ace/Task.h b/ace/Task.h
index cb2a11ce959..b5ee372277b 100644
--- a/ace/Task.h
+++ b/ace/Task.h
@@ -90,7 +90,7 @@ public:
virtual int activate (long flags = THR_NEW_LWP,
int n_threads = 1,
int force_active = 0,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
int grp_id = -1,
ACE_Task_Base *task = 0);
// Turn the task into an active object, i.e., having <n_threads> of
@@ -110,7 +110,8 @@ public:
// THR_SCHED_RR, THR_SCHED_DEFAULT
// = END<INDENT>
//
- // By default, or if <{priority}> is set to -1, an "appropriate"
+ // By default, or if <{priority}> is set to ACE_DEFAULT_THREAD_PRIORITY,
+ // an "appropriate"
// priority value for the given scheduling policy (specified in
// <{flags}>, e.g., <THR_SCHED_DEFAULT>) is used. This value is
// calculated dynamically, and is the median value between the
diff --git a/ace/Thread.h b/ace/Thread.h
index 49faf53aec7..7faae76df0d 100644
--- a/ace/Thread.h
+++ b/ace/Thread.h
@@ -34,7 +34,7 @@ public:
long flags = THR_NEW_LWP,
ACE_thread_t *t_id = 0,
ACE_hthread_t *t_handle = 0,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
void *stack = 0,
size_t stack_size = 0);
// Spawn a new thread having <{flags}> attributes and running
@@ -50,7 +50,8 @@ public:
// THR_SCHED_RR, THR_SCHED_DEFAULT
// = END<INDENT>
//
- // By default, or if <{priority}> is set to -1, an "appropriate"
+ // By default, or if <{priority}> is set to ACE_DEFAULT_THREAD_PRIORITY,
+ // an "appropriate"
// priority value for the given scheduling policy (specified in
// <{flags}>, e.g., <THR_SCHED_DEFAULT>) is used. This value is
// calculated dynamically, and is the median value between the
@@ -63,7 +64,7 @@ public:
ACE_THR_FUNC func,
void *arg = 0,
long flags = THR_NEW_LWP,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
void *stack[] = 0,
size_t stack_size[] = 0);
// Spawn N new threads, which execute <func> with argument <arg>.
@@ -82,7 +83,7 @@ public:
ACE_THR_FUNC func,
void *arg,
long flags,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
void *stack[] = 0,
size_t stack_size[] = 0,
ACE_hthread_t thread_handles[] = 0);
diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h
index 8dd8baa0649..ac486095846 100644
--- a/ace/Thread_Manager.h
+++ b/ace/Thread_Manager.h
@@ -100,7 +100,7 @@ public:
long flags = THR_NEW_LWP,
ACE_thread_t * = 0,
ACE_hthread_t *t_handle = 0,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
int grp_id = -1,
void *stack = 0,
size_t stack_size = 0);
@@ -112,7 +112,7 @@ public:
ACE_THR_FUNC func,
void *args = 0,
long flags = THR_NEW_LWP,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
int grp_id = -1,
ACE_Task_Base *task = 0);
// Create N new threads, all of which execute <func>.
@@ -124,7 +124,7 @@ public:
ACE_THR_FUNC func,
void *args,
long flags,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
int grp_id = -1,
void *stack[] = 0,
size_t stack_size[] = 0,
@@ -282,7 +282,7 @@ protected:
long flags,
ACE_thread_t * = 0,
ACE_hthread_t *t_handle = 0,
- long priority = -1,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
int grp_id = -1,
void *stack = 0,
size_t stack_size = 0,