summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Cleeland <chris.cleeland@gmail.com>2003-03-18 21:04:00 +0000
committerChris Cleeland <chris.cleeland@gmail.com>2003-03-18 21:04:00 +0000
commitd76a9771525cfe0bb3ff5569be0b1d007c5cf165 (patch)
treecd4922b4d55f0c73f6a7e3281437a94918e9e0ac
parentec2d0ee6d02253a14e88337b6575a3d679ae5f82 (diff)
downloadATCD-d76a9771525cfe0bb3ff5569be0b1d007c5cf165.tar.gz
Merged out changes from TAO 1.3.1 release.
-rw-r--r--TAO/PMBChangeLog17
-rw-r--r--TAO/tao/IIOP_Transport.cpp66
-rw-r--r--TAO/tao/MCAST_Parser.cpp17
-rw-r--r--TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp1
-rw-r--r--TAO/tao/RTCORBA/RT_ORBInitializer.cpp70
-rw-r--r--TAO/tao/RTCORBA/RT_ORBInitializer.h12
-rw-r--r--TAO/tao/RTCORBA/RT_ORB_Loader.cpp14
-rw-r--r--TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp5
8 files changed, 162 insertions, 40 deletions
diff --git a/TAO/PMBChangeLog b/TAO/PMBChangeLog
index 5cf756fe720..90cad1ea3a6 100644
--- a/TAO/PMBChangeLog
+++ b/TAO/PMBChangeLog
@@ -1,3 +1,20 @@
+Tue Mar 18 14:57:07 2003 Chris Cleeland <cleeland_c@ociweb.com>
+
+ * tao/IIOP_Transport.cpp:
+ * tao/MCAST_Parser.cpp:
+ * tao/RTCORBA/Linerar_Priority_Mapping.cpp:
+ * tao/RTCORBA/RT_ORBInitializer.cpp:
+ * tao/RTCORBA/RT_ORBInitializer.h:
+ * tao/RTCORBA/RT_ORB_Loader.cpp:
+ * tao/RTCORBA/RT_Protocols_Hooks.cpp:
+
+ Merged in changes from TAO 1.3.1. The actual tag for the merge
+ was pmb_branch_mainline_mergeout_1. The command was
+
+ $ cvs update -jpmb_branch_start -jpmb_branch_mainline_mergeout_1
+
+ after manually determining which files needed updates.
+
Mon Mar 17 11:09:00 2003 Chris Cleeland <cleeland_c@ociweb.com>
* tao/GIOP_Message_Base.cpp (check_for_valid_header): Optimized
diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp
index b7185472584..d825b781352 100644
--- a/TAO/tao/IIOP_Transport.cpp
+++ b/TAO/tao/IIOP_Transport.cpp
@@ -180,12 +180,11 @@ TAO_IIOP_Transport::send_request (TAO_Stub *stub,
if (tph != 0)
{
- /*
- int send_buffer_size;
- int recv_buffer_size;
- int no_delay;
- int enable_network_priority;
- */
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
+
+ if (this->check_event_handler_i ("IIOP_Transport::send_request")
+ == -1)
+ return -1;
const char protocol[] = "iiop";
const char * protocol_type = protocol;
@@ -268,7 +267,7 @@ TAO_IIOP_Transport::send_message_shared (TAO_Stub *stub,
{
ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
- if (this->check_event_handler_i ("Transport::send_message_shared") == -1)
+ if (this->check_event_handler_i ("IIOP_Transport::send_message_shared") == -1)
return -1;
if (TAO_debug_level > 6)
@@ -346,6 +345,18 @@ TAO_IIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr)
// As we have received a bidirectional information, set the flag to
// 1 (i.e., non-originating side)
this->bidirectional_flag (1);
+
+ // Just make sure that the connection handler is sane before we go
+ // head and do anything with it.
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->handler_lock_,
+ -1);
+
+ if (this->check_event_handler_i ("IIOP_Transport::tear_listen_point_list")
+ == -1)
+ return -1;
+
return this->connection_handler_->process_listen_point_list (listen_list);
}
@@ -368,10 +379,15 @@ TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails)
// Check whether it is a IIOP acceptor
if ((*acceptor)->tag () == IOP::TAG_INTERNET_IOP)
{
- // @@ Why isn't the return value checked!
- // -Ossama
- this->get_listen_point (listen_point_list,
- *acceptor);
+ if (this->get_listen_point (listen_point_list,
+ *acceptor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - IIOP_Transport::set_bidir_info, ",
+ "error getting listen_point \n"));
+
+ return;
+ }
}
}
@@ -410,16 +426,28 @@ TAO_IIOP_Transport::get_listen_point (
// Get the local address of the connection
ACE_INET_Addr local_addr;
+ {
+ // Just make sure that the connection handler is sane before we go
+ // head and do anything with it.
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->handler_lock_,
+ -1);
+
+ if (this->check_event_handler_i ("IIOP_Transport::get_listen_point")
+ == -1)
+ return -1;
- if (this->connection_handler_->peer ().get_local_addr (local_addr)
- == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Could not resolve local ")
+ if (this->connection_handler_->peer ().get_local_addr (local_addr)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Could not resolve local ")
ACE_TEXT ("host address in ")
- ACE_TEXT ("get_listen_point()\n")),
- -1);
- }
+ ACE_TEXT ("get_listen_point()\n")),
+ -1);
+ }
+ }
// Note: Looks like there is no point in sending the list of
// endpoints on interfaces on which this connection has not
diff --git a/TAO/tao/MCAST_Parser.cpp b/TAO/tao/MCAST_Parser.cpp
index 6ddeed7531a..5ab85188a43 100644
--- a/TAO/tao/MCAST_Parser.cpp
+++ b/TAO/tao/MCAST_Parser.cpp
@@ -313,8 +313,23 @@ TAO_MCAST_Parser::multicast_query (char *&buf,
}
}
}
+ if (result == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("\nmulticast discovery of %s failed.\n"),
+ service_name));
+
+ if (ACE_OS::strcasecmp (service_name,
+ "NameService") == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("Specify -m 1 when starting Naming_Service,\n")
+ ACE_TEXT("or see http://www.theaceorb.com/faq/#115\n")
+ ACE_TEXT("for using NameService without multicast.\n\n")));
+ }
+ }
}
-
+
// Clean up.
stream.close ();
dgram.close ();
diff --git a/TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp
index f45c7ae3ea0..9c169d29349 100644
--- a/TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp
+++ b/TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp
@@ -125,7 +125,6 @@ TAO_Linear_Priority_Mapping::to_CORBA (RTCORBA::NativePriority native_priority,
&& (native_priority < this->max_
|| native_priority > this->min_)))
{
- if (TAO_debug_level > 2)
ACE_DEBUG ((LM_DEBUG,
"TAO (%P|%t) - Linear_Priority_Mapping::to_CORBA: "
" priority %d out of range [%d,%d]\n",
diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp
index 08d325042f4..0d37addd1eb 100644
--- a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp
+++ b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp
@@ -30,6 +30,7 @@ ACE_RCSID (TAO, RT_ORBInitializer, "$Id$")
#include "ace/Service_Repository.h"
#include "ace/Svc_Conf.h"
+#include "ace/Sched_Params.h"
static const char *rt_poa_factory_name = "TAO_RT_POA";
static const char *rt_poa_factory_directive = "dynamic TAO_RT_POA Service_Object * TAO_RTPortableServer:_make_TAO_RT_Object_Adapter_Factory()";
@@ -41,8 +42,25 @@ TAO_RT_ORBInitializer::TAO_RT_ORBInitializer (int priority_mapping_type,
: priority_mapping_type_ (priority_mapping_type),
network_priority_mapping_type_ (network_priority_mapping_type),
sched_policy_ (sched_policy),
+ sched_policy_flags_ (0),
scope_policy_ (scope_policy)
{
+ switch (sched_policy_)
+ {
+ case ACE_SCHED_RR:
+ sched_policy_flags_ = THR_SCHED_RR;
+ break;
+ case ACE_SCHED_FIFO:
+ sched_policy_flags_ = THR_SCHED_FIFO;
+ break;
+ case ACE_SCHED_OTHER:
+ sched_policy_flags_ = THR_SCHED_DEFAULT;
+ break;
+ default:
+ ACE_DEBUG((LM_DEBUG, ACE_LIB_TEXT("(%N,%l) Unknown sched_policy value.\nDefaulting to THR_SCHED_DEFAULT for sched_policy_flags_.\n") ));
+ sched_policy_flags_ = THR_SCHED_DEFAULT;
+ break;
+ }
}
void
@@ -83,29 +101,22 @@ TAO_RT_ORBInitializer::pre_init (
TAO_RT_Protocols_Hooks::set_server_protocols_hook
(TAO_ServerProtocolPolicy::hook);
- // Conversion.
- long sched_policy = ACE_SCHED_OTHER;
- if (this->sched_policy_ == THR_SCHED_FIFO)
- sched_policy = ACE_SCHED_FIFO;
- else if (this->sched_policy_ == THR_SCHED_RR)
- sched_policy = ACE_SCHED_RR;
-
// Create the initial priority mapping instance.
TAO_Priority_Mapping *pm;
switch (this->priority_mapping_type_)
{
case TAO_PRIORITY_MAPPING_CONTINUOUS:
ACE_NEW (pm,
- TAO_Continuous_Priority_Mapping (sched_policy));
+ TAO_Continuous_Priority_Mapping (this->sched_policy_));
break;
case TAO_PRIORITY_MAPPING_LINEAR:
ACE_NEW (pm,
- TAO_Linear_Priority_Mapping (sched_policy));
+ TAO_Linear_Priority_Mapping (this->sched_policy_));
break;
default:
case TAO_PRIORITY_MAPPING_DIRECT:
ACE_NEW (pm,
- TAO_Direct_Priority_Mapping (sched_policy));
+ TAO_Direct_Priority_Mapping (this->sched_policy_));
break;
}
@@ -136,7 +147,7 @@ TAO_RT_ORBInitializer::pre_init (
default:
case TAO_NETWORK_PRIORITY_MAPPING_LINEAR:
ACE_NEW (npm,
- TAO_Linear_Network_Priority_Mapping (sched_policy));
+ TAO_Linear_Network_Priority_Mapping (this->sched_policy_));
break;
}
@@ -215,7 +226,42 @@ TAO_RT_ORBInitializer::pre_init (
ACE_CHECK;
tao_info->orb_core ()->orb_params ()->scope_policy (this->scope_policy_);
- tao_info->orb_core ()->orb_params ()->sched_policy (this->sched_policy_);
+
+ /* We need to store sched_policy_flags_ and not sched_policy_ in the
+ * orb_params(), because in TAO_Thread_Lane::create_dynamic_threads(),
+ * the flags are passed to ACE_Task_Base::activate() in order to set
+ * the priority.
+ */
+ tao_info->orb_core ()->orb_params ()->sched_policy (this->sched_policy_flags_);
+
+ /* Based on what the scheduling policy is, set the priority to the lowest
+ * priority for that scheduling policy. We need to do this in order to
+ * set the pthread policy for pthread_setschedparam().
+ * Also, we want the pthread policy and priority to be set to a sensible
+ * value, since the post_invoke() operation in the RT-POA will reset the
+ * CORBA priority to what it was before an incoming request.
+ */
+ int priority;
+ ACE_hthread_t thr_id;
+ ACE_Thread::self(thr_id);
+
+ int result = ACE_OS::thr_getprio(thr_id, priority);
+ if ( result != 0 ) {
+ ACE_ERROR ((LM_ERROR, "(%N,%l) ACE_OS::thr_getprio failed, priority %d errno: %d %m\n", priority, errno));
+ return;
+ }
+
+ int priority_min = ACE_Sched_Params::priority_min(this->sched_policy_);
+ int priority_max = ACE_Sched_Params::priority_max(this->sched_policy_);
+ if(priority < priority_min || priority > priority_max) { // Check this
+ priority = priority_min;
+ }
+
+ result = ACE_OS::thr_setprio(thr_id, priority, this->sched_policy_);
+ if ( result != 0 ) {
+ ACE_ERROR ((LM_ERROR, "(%N,%l) ACE_OS::thr_setprio failed, priority %d errno: %d %m\n", priority, errno));
+ }
+
}
void
diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.h b/TAO/tao/RTCORBA/RT_ORBInitializer.h
index f03b0ff864d..395aa0d70e6 100644
--- a/TAO/tao/RTCORBA/RT_ORBInitializer.h
+++ b/TAO/tao/RTCORBA/RT_ORBInitializer.h
@@ -88,9 +88,19 @@ private:
/// Network Priority mapping type.
int network_priority_mapping_type_;
- /// Scheduling policy.
+ /** Scheduling policy. This value is passed to ACE_OS::thr_setprio().
+ * For POSIX pthreads, it maps directly to the pthread_setschedparam() policy
+ * parameter. Legal values are ACE_SCHED_RR, ACE_SCHED_FIFO,
+ * ACE_SCHED_OTHER, ACE_SCHED_*, etc.
+ */
long sched_policy_;
+ /** Scheduling policy flags. This value is passed as part of the
+ * flags argument to ACE_Task_Base::activate(). Legal values are
+ * THR_SCHED_RR, THR_SCHED_FIFO, THR_SCHED_DEFAULT, etc.
+ */
+ long sched_policy_flags_;
+
/// Scope policy.
long scope_policy_;
};
diff --git a/TAO/tao/RTCORBA/RT_ORB_Loader.cpp b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp
index e13bf36fea5..586001c7399 100644
--- a/TAO/tao/RTCORBA/RT_ORB_Loader.cpp
+++ b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp
@@ -35,7 +35,7 @@ TAO_RT_ORB_Loader::init (int argc,
// Set defaults.
int priority_mapping_type = TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_DIRECT;
int network_priority_mapping_type = TAO_RT_ORBInitializer::TAO_NETWORK_PRIORITY_MAPPING_LINEAR;
- long sched_policy = THR_SCHED_DEFAULT;
+ long sched_policy = -1;
long scope_policy = THR_SCOPE_PROCESS;
int curarg = 0;
@@ -75,13 +75,13 @@ TAO_RT_ORB_Loader::init (int argc,
if (ACE_OS::strcasecmp (name,
ACE_LIB_TEXT("SCHED_OTHER")) == 0)
- sched_policy = THR_SCHED_DEFAULT;
+ sched_policy = ACE_SCHED_OTHER;
else if (ACE_OS::strcasecmp (name,
ACE_LIB_TEXT("SCHED_FIFO")) == 0)
- sched_policy = THR_SCHED_FIFO;
+ sched_policy = ACE_SCHED_FIFO;
else if (ACE_OS::strcasecmp (name,
ACE_LIB_TEXT("SCHED_RR")) == 0)
- sched_policy = THR_SCHED_RR;
+ sched_policy = ACE_SCHED_RR;
else
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT("RT_ORB_Loader - unknown argument")
@@ -134,6 +134,12 @@ TAO_RT_ORB_Loader::init (int argc,
}
}
+ if (sched_policy == -1) {
+ ACE_ERROR_RETURN( (LM_ERROR,
+ ACE_LIB_TEXT("(%N,%l) -ORBSchedPolicy not defined.\n") ),
+ -1);
+ }
+
// Register the ORB initializer.
ACE_TRY_NEW_ENV
{
diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
index 3a8d90c2553..e01ab7aa269 100644
--- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
+++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
@@ -596,8 +596,9 @@ TAO_RT_Protocols_Hooks::set_thread_native_priority (CORBA::Short native_priority
ACE_hthread_t current;
ACE_Thread::self (current);
- if (ACE_Thread::setprio (current, native_priority) == -1)
- return -1;
+ if (ACE_Thread::setprio (current, native_priority) == -1) {
+ ACE_ERROR_RETURN((LM_ERROR, ACE_LIB_TEXT("(%N,%l) Error setting thread priority to %d, errno %d %m\n"), native_priority, errno ), -1);
+ }
return 0;
}