From d74ace6de6cd1c5c864cff7f67e3661f681b55a2 Mon Sep 17 00:00:00 2001 From: crodrigu Date: Wed, 12 Feb 2003 00:02:13 +0000 Subject: ChangeLogTag: Wed Feb 12 00:00:12 UTC 2003 Craig Rodrigues --- ChangeLog | 7 +++++++ ChangeLogs/ChangeLog-03a | 7 +++++++ ace/OS.h | 2 +- ace/OS.i | 24 +++++++++++++++++------- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 284137939cd..562ecdba6e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Feb 12 00:00:12 UTC 2003 Craig Rodrigues + + * ace/OS.h: + * ace/OS.i (thr_setprio): Add a new default thr_policy parameter which + allows us to explicitly set the policy in pthread_setschedparam(). + Introduced to eliminate a bug discovered in RT-CORBA implementation. + Tue Feb 11 14:01:21 2003 Nanbor Wang * vc7_nightly.mwc: Added a temporary file specifying core nightly diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 284137939cd..562ecdba6e3 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,10 @@ +Wed Feb 12 00:00:12 UTC 2003 Craig Rodrigues + + * ace/OS.h: + * ace/OS.i (thr_setprio): Add a new default thr_policy parameter which + allows us to explicitly set the policy in pthread_setschedparam(). + Introduced to eliminate a bug discovered in RT-CORBA implementation. + Tue Feb 11 14:01:21 2003 Nanbor Wang * vc7_nightly.mwc: Added a temporary file specifying core nightly diff --git a/ace/OS.h b/ace/OS.h index a57ff7b7677..b4f40edd07d 100644 --- a/ace/OS.h +++ b/ace/OS.h @@ -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); diff --git a/ace/OS.i b/ace/OS.i index 843036b03bf..b151b073fd4 100644 --- a/ace/OS.i +++ b/ace/OS.i @@ -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), -- cgit v1.2.1