diff options
author | thrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-12-13 00:00:56 +0000 |
---|---|---|
committer | thrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-12-13 00:00:56 +0000 |
commit | 87fc45f3e91bb600708b1f477bd54919ba702fef (patch) | |
tree | 99c1f60735178e29b6654a6cfcce0f676b3fa934 | |
parent | e414168da2d2b4d186f8731882543c7c206e1212 (diff) | |
download | ATCD-87fc45f3e91bb600708b1f477bd54919ba702fef.tar.gz |
Fixed segfault on second push by Supplier triggered by timeout. New
bugs: ECConsumer doesn't seem to receive events when worktime_ set;
doesn't seem to ever actually push events after finishing work.
4 files changed, 37 insertions, 20 deletions
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp index c4ee713cbb8..1a6847bf865 100644 --- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp +++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp @@ -13,6 +13,7 @@ #include "ace/Hash_Map_Manager.h" #include "tao/ORB_Core.h" +#include "orbsvcs/Time_Utilities.h" // ORBSVCS_Time #include "RtecSchedulerC.h" @@ -448,24 +449,28 @@ Configurator_SyntaxHandler::parseConsumer (Consumer* vs, void* arg) //ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer dependants at %@\n"),vs->dependants)); // Register Consumer - /* - RtEventChannelAdmin::RtSchedEventChannel *ec = - static_cast<RtEventChannelAdmin::RtSchedEventChannel*> (arg); - */ Kokyu_EC *ec = static_cast<Kokyu_EC*> (arg); // TODO: negotiate event types + RtEventChannelAdmin::Time max_exec; ECSupplier::EventTypeVector subtypes; Kokyu_EC::QoSVector::iterator subiter = subs.begin(); for (; subiter != subs.end(); ++subiter) { Kokyu_EC::QoSVector::value_type qos = *subiter; + + if (max_exec < qos.wc_time) // find maximum worst-case time + max_exec = qos.wc_time; + subtypes.push_back(qos.type); } + ACE_Time_Value exec_time; // Consumer executes max worst-case time + ORBSVCS_Time::TimeT_to_Time_Value (exec_time,max_exec); ECConsumer *consumer; ACE_NEW_RETURN(consumer, ECConsumer(subtypes),-1); + //consumer->setWorkTime(exec_time); // for each dependant, set up the dependency SupplierVector::iterator siter = dependants.begin(); @@ -568,14 +573,12 @@ Configurator_SyntaxHandler::parseSupplier (Supplier* vs, void* arg) */ Kokyu_EC *ec = static_cast<Kokyu_EC*> (arg); - // TODO: negotiate event types - ECSupplier::EventType type = 100 * vs->id; - ECSupplier::EventTypeVector pubtypes; Kokyu_EC::QoSVector::iterator pubiter = pubs.begin(); - for (; pubiter != pubs.end(); ++pubiter,++type) + for (; pubiter != pubs.end(); ++pubiter) { - pubtypes.push_back(type); + Kokyu_EC::QoSVector::value_type schedinfo = *pubiter; + pubtypes.push_back(pubiter->type); } ECSupplier *supplier; @@ -592,13 +595,18 @@ Configurator_SyntaxHandler::parseSupplier (Supplier* vs, void* arg) ACE_NEW_RETURN(timeout, ECSupplier_Timeout_Handler(supplier),-1); + ACE_Time_Value phase; + ORBSVCS_Time::TimeT_to_Time_Value (phase,qos.phase); + ACE_Time_Value period; + ORBSVCS_Time::TimeT_to_Time_Value (period,qos.period); + // if multiple timeouts, this won't reg supplier multiple times ec->add_supplier_with_timeout(supplier, vs->name.c_str(), pubtypes, timeout, - qos.phase, - qos.period, + phase, + period, RtecScheduler::LOW_CRITICALITY, RtecScheduler::LOW_IMPORTANCE ACE_ENV_ARG_PARAMETER @@ -616,6 +624,7 @@ Configurator_SyntaxHandler::parsePublications (Publications* vs, void* arg) Kokyu_EC::QoSVector *pubs = static_cast<Kokyu_EC::QoSVector*> (arg); ACE_ASSERT(pubs); + // TODO: negotiate event types // parse Publications EventNameVector::iterator eniter = vs->eventnames.begin(); for (; eniter != vs->eventnames.end(); eniter++) @@ -628,6 +637,8 @@ Configurator_SyntaxHandler::parsePublications (Publications* vs, void* arg) error += (*eniter)->str; ACEXML_THROW (ACEXML_SAXException (error.c_str())); } + // else pubqos retrieved + pubs->push_back(pubqos); } return 0; @@ -652,6 +663,7 @@ Configurator_SyntaxHandler::parseTriggers (Triggers* vs, void* arg) error += (*tniter)->str; ACEXML_THROW (ACEXML_SAXException (error.c_str())); } + // else trigqos retrieved trigs->push_back(trigqos); } diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp index e36418e9e36..2160cbbcf7a 100644 --- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp +++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp @@ -43,8 +43,7 @@ ECConsumer::push (const RtecEventComm::EventSet& events { if (events.length () == 0) { - ACE_DEBUG ((LM_DEBUG, - "ECConsumer (%P|%t) no events\n")); + ACE_DEBUG ((LM_DEBUG,"ECConsumer (%P|%t) no events\n")); return; } @@ -72,6 +71,10 @@ ECConsumer::push (const RtecEventComm::EventSet& events ACE_DEBUG((LM_DEBUG,"ECConsumer (%P|%t) worktime is %isec %iusec\n", this->worktime_.sec(),this->worktime_.usec())); + // DEBUG + //this->worktime_.set(0,200000); + // END DEBUG + ACE_Time_Value start_time(ACE_OS::gettimeofday()); timer.start(); int j=0; diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp index 41f75d82bb0..bd0f956c8db 100644 --- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp +++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.cpp @@ -21,13 +21,13 @@ ECSupplier::ECSupplier (SourceID id, } ECSupplier::~ECSupplier (void) -{ -} +{} void -ECSupplier::set_consumer_proxy(ConsumerProxy proxy) +ECSupplier::set_consumer_proxy(ConsumerProxy::_ptr_type proxy) { - this->consumer_proxy_ = proxy; + // copy the ref + this->consumer_proxy_ = ConsumerProxy::_duplicate(proxy); } void @@ -63,6 +63,8 @@ ECSupplier::timeout_occured (ACE_ENV_SINGLE_ARG_DECL) this->consumer_proxy_->push (event ACE_ENV_ARG_PARAMETER); + ACE_DEBUG((LM_DEBUG,"ECSupplier (id %d) in thread %t pushed event\n",this->id_)); + if (this->handler_ != 0) { ACE_DEBUG((LM_DEBUG,"ECSupplier (%P|%t) calling handle_service_stop()\n")); diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h index 3cf9516f778..28a0f593dc3 100644 --- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h +++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECSupplier.h @@ -47,7 +47,7 @@ class ECSupplier : public POA_RtecEventComm::PushSupplier // and it is up to the driver program to use the right one. // public: - typedef RtecEventChannelAdmin::ProxyPushConsumer_var ConsumerProxy; + typedef RtecEventChannelAdmin::ProxyPushConsumer ConsumerProxy; typedef RtecEventComm::EventSourceID SourceID; typedef RtecEventComm::EventType EventType; typedef std::vector<EventType> EventTypeVector; @@ -67,7 +67,7 @@ public: virtual void timeout_occured (ACE_ENV_SINGLE_ARG_DECL); - void set_consumer_proxy(ConsumerProxy consumer_proxies); + void set_consumer_proxy(ConsumerProxy::_ptr_type consumer_proxies); void rt_info(InfoHandle supplier_rt_info); InfoHandle rt_info(void); @@ -82,7 +82,7 @@ protected: SourceID id_; EventTypeVector pub_types_; - ConsumerProxy consumer_proxy_; + ConsumerProxy::_var_type consumer_proxy_; InfoHandle rt_info_; |