summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-22 20:06:46 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-22 20:06:46 +0000
commit917c220609133d2264e5edadb4650d8058076373 (patch)
treee53252f59bd47663568b1eb0f01302bf4c7b7ce8
parent47afb9a4886dd3777624ff0bc2790c0c1919007f (diff)
downloadATCD-917c220609133d2264e5edadb4650d8058076373.tar.gz
ChangeLogTag:Thu Jul 22 15:05:21 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-99c11
-rw-r--r--TAO/tao/Invocation.cpp14
-rw-r--r--TAO/tao/Wait_Strategy.cpp28
3 files changed, 36 insertions, 17 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index b73e11cc2c6..a77bfcd31da 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,14 @@
+Thu Jul 22 15:05:21 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * tao/Invocation.cpp:
+ Fixed timeout computation it was off by a factor of 10 (thanks
+ to the OMG 1/10 of a microsecond units!)
+
+ * tao/Wait_Strategy.cpp:
+ Improved loop conditions to cope with reactors that return 0
+ even when there is no timeout. Thanks to Irfan for pointing this
+ out.
+
Thu Jul 22 14:10:47 1999 David L. Levine <levine@cs.wustl.edu>
* orbsvcs/tests/AVStreams/benchmark/client.cpp:
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 7b1e280ed0e..4c50530ee67 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -152,7 +152,7 @@ TAO_GIOP_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
timeout->relative_expiry (ACE_TRY_ENV);
ACE_CHECK;
TimeBase::TimeT seconds = t / 10000000u;
- TimeBase::TimeT microseconds = t % 10000000u;
+ TimeBase::TimeT microseconds = (t % 10000000u) / 10;
this->max_wait_time_value_.set (ACE_U64_TO_U32(seconds),
ACE_U64_TO_U32(microseconds));
this->max_wait_time_ = &this->max_wait_time_value_;
@@ -641,14 +641,14 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV)
this->transport_->wait_for_reply (this->max_wait_time_);
// Do the wait loop till we receive the reply for this invocation.
- // while (reply_error != -1 &&
+ // while (reply_error != -1 &&
// this->transport_->reply_received (this->request_id_) != 1)
// {
// // @@ Hack to init the Leader-Follower state, so that we can
// // wait again. (Alex).
// // this->transport_->wait_strategy ()->sending_request (this->orb_core_,
// // 1);
- //
+ //
// // Wait for reply.
// reply_error = this->transport_->wait_for_reply ();
// }
@@ -785,7 +785,7 @@ TAO_GIOP_Oneway_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
// ****************************************************************
-// Send request, block until any reply comes back.
+// Send request, block until any reply comes back.
void
TAO_GIOP_Locate_Request_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
@@ -862,13 +862,13 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV)
int reply_error =
this->transport_->wait_for_reply (this->max_wait_time_);
- // // Do the wait loop, till we receive the reply for this invocation.
- // while (reply_error != -1 &&
+ // // Do the wait loop, till we receive the reply for this invocation.
+ // while (reply_error != -1 &&
// this->transport_->reply_received (this->request_id_) != 1)
// {
// reply_error = this->transport_->wait_for_reply ();
// }
-
+
// Check the reply error.
if (reply_error == -1)
{
diff --git a/TAO/tao/Wait_Strategy.cpp b/TAO/tao/Wait_Strategy.cpp
index 44cd1feb188..49c696aca07 100644
--- a/TAO/tao/Wait_Strategy.cpp
+++ b/TAO/tao/Wait_Strategy.cpp
@@ -47,10 +47,14 @@ TAO_Wait_On_Reactor::wait (ACE_Time_Value *max_wait_time)
this->transport_->orb_core ()->reactor ();
// Do the event loop, till we fully receive a reply.
-
- int result = 1; // So the first iteration works...
+
+ int result = 1; // Optimize the first iteration [no access to errno]
this->reply_received_ = 0;
- while (this->reply_received_ == 0 && result > 0)
+ while (this->reply_received_ == 0
+ && (result > 0
+ || (result == 0
+ && max_wait_time != 0
+ && *max_wait_time != ACE_Time_Value::zero)))
{
result = reactor->handle_events (max_wait_time);
}
@@ -149,7 +153,7 @@ TAO_Wait_On_Leader_Follower::sending_request (TAO_ORB_Core *orb_core,
// Register the handler.
this->transport_->register_handler ();
-
+
// Send the request.
int result =
this->TAO_Wait_Strategy::sending_request (orb_core,
@@ -260,7 +264,7 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time)
if (this->reply_received_ == 1)
{
// But first reset our state in case we are invoked
- // again...
+ // again...
this->reply_received_ = 0;
this->expecting_response_ = 0;
this->calling_thread_ = ACE_OS::NULL_thread;
@@ -270,7 +274,7 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time)
else if (this->reply_received_ == -1)
{
// But first reset our state in case we are invoked
- // again...
+ // again...
this->reply_received_ = 0;
this->expecting_response_ = 0;
this->calling_thread_ = ACE_OS::NULL_thread;
@@ -294,7 +298,7 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time)
// This might increase the refcount of the leader.
leader_follower.set_leader_thread ();
- int result = 1;
+ int result = 1; // Optmize the first iteration [no access to errno]
{
ACE_GUARD_RETURN (ACE_Reverse_Lock<ACE_SYNCH_MUTEX>, rev_mon,
@@ -309,7 +313,11 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time)
//ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - wait (leader) on <%x>\n",
//this->transport_));
- while (result > 0 && this->reply_received_ == 0)
+ while (this->reply_received_ == 0
+ && (result > 0
+ || (result == 0
+ && max_wait_time != 0
+ && *max_wait_time != ACE_Time_Value::zero)))
result = orb_core->reactor ()->handle_events (max_wait_time);
//ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - done (leader) on <%x>\n",
@@ -374,7 +382,7 @@ TAO_Wait_On_Leader_Follower::handle_input (void)
// Obtain the lock.
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon,
- orb_core->leader_follower ().lock (),
+ orb_core->leader_follower ().lock (),
-1);
// ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - reading reply <%x>\n",
@@ -479,7 +487,7 @@ TAO_Wait_On_Leader_Follower::wake_up (void)
// We *must* remove it when we signal it so the same condition is
// not signalled for both wake up as a follower and as the next
- // leader.
+ // leader.
// The follower may not be there if the reply is received while the
// consumer is not yet waiting for it (i.e. it send the request but
// has not blocked to receive the reply yet)