diff options
author | crodrigu <crodrigu@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-02-12 00:02:13 +0000 |
---|---|---|
committer | crodrigu <crodrigu@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-02-12 00:02:13 +0000 |
commit | d74ace6de6cd1c5c864cff7f67e3661f681b55a2 (patch) | |
tree | f90f0b354b3c38bb7552dbfec2ce7b78b30eb750 /ace | |
parent | f87c0c10711a1e263dec8abb6497981ab3605319 (diff) | |
download | ATCD-d74ace6de6cd1c5c864cff7f67e3661f681b55a2.tar.gz |
ChangeLogTag: Wed Feb 12 00:00:12 UTC 2003 Craig Rodrigues <crodrigu@bbn.com>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/OS.h | 2 | ||||
-rw-r--r-- | ace/OS.i | 24 |
2 files changed, 18 insertions, 8 deletions
@@ -5888,7 +5888,7 @@ public: static ACE_thread_t thr_self (void); static void thr_self (ACE_hthread_t &); static int thr_setprio (ACE_hthread_t thr_id, - int prio); + int prio, int thr_policy=-1); static int thr_setprio (const ACE_Sched_Priority prio); static int thr_suspend (ACE_hthread_t target_thread); static int thr_cancel (ACE_thread_t t_id); @@ -7290,9 +7290,10 @@ ACE_OS::thr_setconcurrency (int hint) } ACE_INLINE int -ACE_OS::thr_setprio (ACE_hthread_t thr_id, int prio) +ACE_OS::thr_setprio (ACE_hthread_t thr_id, int prio, int thr_policy) { ACE_OS_TRACE ("ACE_OS::thr_setprio"); + ACE_UNUSED_ARG(thr_policy); #if defined (ACE_HAS_THREADS) # if (defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_SETSCHED)) @@ -7312,15 +7313,24 @@ ACE_OS::thr_setprio (ACE_hthread_t thr_id, int prio) int policy = 0; int result; - ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_getschedparam (thr_id, &policy, ¶m), - result), // not sure if use of result here is cool, cjc - int, -1, result); + ACE_ADAPT_RETVAL (::pthread_getschedparam (thr_id, &policy, ¶m), result); + if (result != 0) + result = -1; + if (result == -1) return result; // error in pthread_getschedparam + + /* if thr_policy is -1, we don't want to use it for pthread_setschedparam(). + Instead, use policy which was obtained from pthread_getschedparam() */ + if (thr_policy == -1) + thr_policy = policy; + param.sched_priority = prio; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setschedparam (thr_id, policy, ¶m), - result), - int, -1); + ACE_ADAPT_RETVAL (::pthread_setschedparam (thr_id, thr_policy, ¶m), result); + if (result != 0) + result = -1; + + return result; # endif /* ACE_HAS_PTHREADS_DRAFT4 */ # elif defined (ACE_HAS_STHREADS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_setprio (thr_id, prio), |