From 9ff6964abe18ea37657d7a64ac35b423951b73f1 Mon Sep 17 00:00:00 2001 From: irfan Date: Sun, 26 Aug 2001 01:33:51 +0000 Subject: Minor changes --- TAO/tao/RTCORBA/Thread_Pool.cpp | 6 ++ TAO/tao/RTCORBA/Thread_Pool.h | 2 + TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp | 88 +++++++++++++++------- TAO/threadpool-changes | 16 +++- 4 files changed, 82 insertions(+), 30 deletions(-) diff --git a/TAO/tao/RTCORBA/Thread_Pool.cpp b/TAO/tao/RTCORBA/Thread_Pool.cpp index 021f4b9fa8f..ebae71b2f2a 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.cpp +++ b/TAO/tao/RTCORBA/Thread_Pool.cpp @@ -234,6 +234,12 @@ TAO_Thread_Lane::lane_priority (void) const return this->lane_priority_; } +CORBA::Short +TAO_Thread_Lane::native_priority (void) const +{ + return this->native_priority_; +} + CORBA::ULong TAO_Thread_Lane::static_threads (void) const { diff --git a/TAO/tao/RTCORBA/Thread_Pool.h b/TAO/tao/RTCORBA/Thread_Pool.h index f4743791218..f636d570fec 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.h +++ b/TAO/tao/RTCORBA/Thread_Pool.h @@ -107,6 +107,8 @@ public: CORBA::ULong static_threads (void) const; CORBA::ULong dynamic_threads (void) const; + CORBA::Short native_priority (void) const; + TAO_Thread_Pool_Threads &threads (void); TAO_Thread_Lane_Resources &resources (void); diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp index 2de402a54be..362d6b1be03 100644 --- a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp +++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp @@ -72,10 +72,11 @@ RT_Priority_Model_Processing::pre_invoke ( ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Using thread pool with lane ") - ACE_TEXT ("(%P|%t|%d|%d): original thread CORBA priority %d not changed\n"), + ACE_TEXT ("(%P|%t|%d|%d): original thread CORBA/native priority %d/%d not changed\n"), lane->pool ().id (), lane->id (), - lane->lane_priority ())); + lane->lane_priority (), + lane->native_priority ())); } return; @@ -93,16 +94,23 @@ RT_Priority_Model_Processing::pre_invoke ( ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO)); - int client_propagated = 0; + const char *priority_model; RTCORBA::Priority target_priority = TAO_INVALID_PRIORITY; TAO_POA_Cached_Policies &cached_policies = this->poa_.cached_policies (); - // CLIENT_PROPAGATED PriorityModel processing. + // NOT_SPECIFIED PriorityModel processing. if (cached_policies.priority_model () == + TAO_POA_Cached_Policies::NOT_SPECIFIED) + { + priority_model = "RTCORBA::NOT_SPECIFIED"; + } + + // CLIENT_PROPAGATED PriorityModel processing. + else if (cached_policies.priority_model () == TAO_POA_Cached_Policies::CLIENT_PROPAGATED) { - client_propagated = 1; + priority_model = "RTCORBA::CLIENT_PROPAGATED"; // Attempt to extract client-propagated priority from the // ServiceContextList of the request. @@ -139,16 +147,12 @@ RT_Priority_Model_Processing::pre_invoke ( else // SERVER_DECLARED PriorityModel processing. { + priority_model = "RTCORBA::SERVER_DECLARED"; + // Use the request associated with the servant. target_priority = this->servant_priority_; } - const char *priority_model; - if (client_propagated) - priority_model = "RTCORBA::CLIENT_PROPAGATED"; - else - priority_model = "RTCORBA::SERVER_DECLARED"; - char thread_pool_id[BUFSIZ]; if (TAO_debug_level > 0) { @@ -166,34 +170,62 @@ RT_Priority_Model_Processing::pre_invoke ( if (target_priority != TAO_INVALID_PRIORITY && target_priority != this->original_CORBA_priority_) { + if (tph->set_thread_CORBA_priority (target_priority, + ACE_TRY_ENV) + == -1) + ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO)); + + this->state_ = PRIORITY_RESET_REQUIRED; + if (TAO_debug_level > 0) { + CORBA::Short native_priority; + tph->get_thread_native_priority (native_priority, + ACE_TRY_ENV); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s processing using %s ") ACE_TEXT ("(%P|%t): original thread CORBA/native priority %d/%d ") - ACE_TEXT ("temporarily changed to CORBA %d\n"), + ACE_TEXT ("temporarily changed to CORBA/native priority %d/%d\n"), priority_model, thread_pool_id, this->original_CORBA_priority_, this->original_native_priority_, - target_priority)); + target_priority, + native_priority)); + } + } + // No change in priority required. + else if (target_priority != TAO_INVALID_PRIORITY && + target_priority == this->original_CORBA_priority_) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s processing using %s ") + ACE_TEXT ("(%P|%t): original thread CORBA/native priority %d/%d ") + ACE_TEXT ("is the same as the target priority\n"), + priority_model, + thread_pool_id, + this->original_CORBA_priority_, + this->original_native_priority_)); + } + } + // Target priority is invalid. + else + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s processing using %s ") + ACE_TEXT ("(%P|%t): original thread CORBA/native priority %d/%d ") + ACE_TEXT ("not changed\n"), + priority_model, + thread_pool_id, + this->original_CORBA_priority_, + this->original_native_priority_)); } - - if (tph->set_thread_CORBA_priority (target_priority, - ACE_TRY_ENV) - == -1) - ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO)); - - this->state_ = PRIORITY_RESET_REQUIRED; } - else if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%s processing using %s ") - ACE_TEXT ("(%P|%t): original thread priority = ") - ACE_TEXT ("target priority = %d\n"), - priority_model, - thread_pool_id, - target_priority)); } void diff --git a/TAO/threadpool-changes b/TAO/threadpool-changes index 8f903ab737b..58b4926b669 100644 --- a/TAO/threadpool-changes +++ b/TAO/threadpool-changes @@ -1,4 +1,4 @@ -Fri Aug 17 18:08:37 2001 Irfan Pyarali +Fri Aug 24 18:08:37 2001 Irfan Pyarali * tao/RTPortableServer/RT_POA.cpp: @@ -125,6 +125,12 @@ Fri Aug 17 18:08:37 2001 Irfan Pyarali server priority was , then the client propagated priority was ignored. This was fixed. + Handle cases where the priority model policy was not + specified. + + Distinguish between invalid target priorities and where + the original == target. + * tao/RTPortableServer/RT_POA_Initializer.cpp (init_rt_default_policies): Removed: it was merging the ORB level policies with the default POA policies at initialization @@ -185,6 +191,9 @@ Fri Aug 17 18:08:37 2001 Irfan Pyarali (THR_NEW_LWP and THR_JOINABLE), add in flags to set the scope and scheduling policies when creating RT threads. + - (native_priority): Each lane remembers its native priority + in addition to its CORBA priority. + * tao/RTCORBA/RT_Protocols_Hooks.cpp (set_default_server_protocol_policy): Don't include all the protocols that the ORB knows about in the default server @@ -889,4 +898,7 @@ Fri Aug 17 18:08:37 2001 Irfan Pyarali support. * docs/Options.html: Added documentation for new - -ORBScopePolicy option. \ No newline at end of file + -ORBScopePolicy option. + + * ACE_ROOT/ace/OS.h: THR_SCOPE_PROCESS and THR_SCOPE_SYSTEM + were not defined for NT. Added them. -- cgit v1.2.1