diff options
author | huangming <huangminghuang@users.noreply.github.com> | 2003-11-23 08:26:48 +0000 |
---|---|---|
committer | huangming <huangminghuang@users.noreply.github.com> | 2003-11-23 08:26:48 +0000 |
commit | 472a4b49d5bfdd79c60f4b8e01ee5c83cda4272f (patch) | |
tree | 17c46dfaa6ee5eed69dc0c9d096d5924dc218e88 | |
parent | 0579af9cf4ad12baa10a61f00acd5174e222bd14 (diff) | |
download | ATCD-472a4b49d5bfdd79c60f4b8e01ee5c83cda4272f.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp | 19 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FtRtEvent/PushSupplier.h | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp b/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp index 67112ec78bb..33fe3d91220 100644 --- a/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp +++ b/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp @@ -10,6 +10,8 @@ #include "orbsvcs/FtRtEvent/Utils/resolve_init.h" #include "orbsvcs/FtRtEvent/Utils/Log.h" #include "FtRtEvent_Test.h" +#include "tao/ORB.h" +#include "tao/ORB_Core.h" ACE_RCSID (FtRtEvent, PushSupplier, @@ -36,6 +38,7 @@ PushSupplier_impl::PushSupplier_impl() : supplier_servant_(this) , seq_no_(0) , reactor_task_(this) +, in_timeout_handler_(0) { } @@ -81,9 +84,15 @@ int PushSupplier_impl::init(CORBA::ORB_ptr orb, ACE_DEBUG((LM_DEBUG, "connected to proxy_push_consumer, subscription latency = %d\n", time_val.sec () * 10000000 + time_val.usec ()* 10)); + /* if (!reactor_task_.thr_count() && reactor_task_.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate reactor thread\n"), -1); + */ + + ACE_Reactor* reactor = orb->orb_core()->reactor(); + if (reactor->schedule_timer(this, 0, ACE_Time_Value::zero, options.timer_interval)== -1) + ACE_ERROR_RETURN((LM_ERROR,"Cannot schedule timer\n"),-1); return 0; } @@ -119,6 +128,9 @@ int PushSupplier_impl::handle_timeout (const ACE_Time_Value ¤t_time, ACE_UNUSED_ARG(act); ACE_UNUSED_ARG(current_time); + if (in_timeout_handler_) return 0; + in_timeout_handler_ = 1; + FTRTEC_TRACE("PushSupplier_impl::handle_timeout"); RtecEventComm::EventSet event (1); @@ -132,10 +144,9 @@ int PushSupplier_impl::handle_timeout (const ACE_Time_Value ¤t_time, event[0].header.ec_send_time = time_val.sec () * 10000000 + time_val.usec ()* 10; event[0].data.any_value <<= seq_no_; - bool final = (num_iterations_ <= (int) seq_no_++); + bool final = (num_iterations_ == (int) seq_no_++); - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY { + ACE_TRY_NEW_ENV { if (!final) { consumer_->push(event ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -165,6 +176,6 @@ int PushSupplier_impl::handle_timeout (const ACE_Time_Value ¤t_time, this->reactor(0); orb_->shutdown(); } - + in_timeout_handler_ = 0; return 0; } diff --git a/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.h b/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.h index 771cc943135..7fb1ff135d9 100644 --- a/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.h +++ b/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.h @@ -60,6 +60,8 @@ private: CORBA::ULong seq_no_; ReactorTask reactor_task_; RtecEventChannelAdmin::ProxyPushConsumer_var consumer_; + bool in_timeout_handler_; + PushSupplier_impl(const PushSupplier_impl&); void operator==(const PushSupplier_impl&); }; |