diff options
author | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-03-17 13:55:49 +0000 |
---|---|---|
committer | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-03-17 13:55:49 +0000 |
commit | b5db93e26de4db7ed9dd083b058c9dfacde3a1e6 (patch) | |
tree | cb78f984dceae83473c8f7dc5ddc2c35a2e336c1 /TAO/examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp | |
parent | 3a7b3e4e0a4739c1326e04498fcc0c91faa885bf (diff) | |
download | ATCD-b5db93e26de4db7ed9dd083b058c9dfacde3a1e6.tar.gz |
Wed Mar 17 13:44:06 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com>
* tao/RTScheduling/Request_Interceptor.cpp:
* tao/RTScheduling/RTScheduler_Manager.inl:
* tao/RTScheduling/Current.cpp:
* tao/RTScheduling/Current.h:
* tao/RTScheduling/RTScheduler_Initializer.cpp:
* tao/RTScheduling/RTScheduler_Initializer.h:
Fixed a number of memory leaks.
* tests/RTScheduling/DT_Spawn/test.cpp:
* tests/RTScheduling/DT_Spawn/Thread_Action.h:
* tests/RTScheduling/Scheduler.cpp:
* tests/RTScheduling/Current/Thread_Task.cpp:
* tests/RTScheduling/Scheduling_Interceptor/test_server.cpp:
* tests/RTScheduling/VoidData/test_client.cpp:
* tests/RTScheduling/Thread_Cancel/Thread_Task.h:
* tests/RTScheduling/Thread_Cancel/test.cpp:
* tests/RTScheduling/Thread_Cancel/Thread_Task.cpp:
* examples/Kokyu_dsrt_schedulers/fp_example/client.cpp:
* examples/Kokyu_dsrt_schedulers/fp_example/server.cpp:
* examples/Kokyu_dsrt_schedulers/fp_example/test_i.cpp:
* examples/Kokyu_dsrt_schedulers/FP_Scheduler.cpp:
* examples/Kokyu_dsrt_schedulers/mif_example/client.cpp:
* examples/Kokyu_dsrt_schedulers/mif_example/server.cpp:
* examples/Kokyu_dsrt_schedulers/mif_example/test_i.cpp:
* examples/Kokyu_dsrt_schedulers/MIF_Scheduler.cpp:
* examples/Kokyu_dsrt_schedulers/muf_example/client.cpp:
* examples/Kokyu_dsrt_schedulers/muf_example/server.cpp:
* examples/Kokyu_dsrt_schedulers/muf_example/test_i.cpp:
* examples/Kokyu_dsrt_schedulers/MUF_Scheduler.cpp:
* examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp:
* examples/RTScheduling/Thread_Task.h:
* examples/RTScheduling/POA_Holder.cpp:
* examples/RTScheduling/Fixed_Priority_Scheduler/FP_Scheduler.cpp:
* examples/RTScheduling/Fixed_Priority_Scheduler/FP_Scheduler.h:
* examples/RTScheduling/Fixed_Priority_Scheduler/test.cpp:
* examples/RTScheduling/Fixed_Priority_Scheduler/test.h:
* examples/RTScheduling/Fixed_Priority_Scheduler/FP_Task.cpp:
* examples/RTScheduling/Fixed_Priority_Scheduler/run_test.pl:
* examples/RTScheduling/Job_i.cpp:
* examples/RTScheduling/DT_Creator.cpp:
* examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.cpp:
* examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.h:
* examples/RTScheduling/MIF_Scheduler/test.cpp:
* examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.cpp:
* examples/RTScheduling/MIF_Scheduler/test.h:
* examples/RTScheduling/MIF_Scheduler/run_test.pl:
* examples/RTScheduling/MIF_Scheduler/MIF_Task.cpp:
* examples/RTScheduling/Thread_Task.cpp:
* examples/RTScheduling/DT_Creator.h:
Fixed a lot of memory leaks which are actually similar from test
to test.
Diffstat (limited to 'TAO/examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp')
-rw-r--r-- | TAO/examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp b/TAO/examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp index f036d5d85f8..66dd7848174 100644 --- a/TAO/examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp +++ b/TAO/examples/Kokyu_dsrt_schedulers/EDF_Scheduler.cpp @@ -30,7 +30,7 @@ EDF_Scheduler::EDF_Scheduler (CORBA::ORB_ptr orb, Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type, int ace_sched_policy, int ace_sched_scope) - : orb_ (orb), + : orb_ (CORBA::ORB::_duplicate (orb)), disp_impl_type_ (disp_impl_type), ace_sched_policy_ (ace_sched_policy), ace_sched_scope_ (ace_sched_scope) @@ -230,9 +230,10 @@ void EDF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri) { int int_guid; + RTScheduling::Current::IdType_var guid = this->current_->id (); ACE_OS::memcpy (&int_guid, - this->current_->id ()->get_buffer (), - this->current_->id ()->length ()); + guid->get_buffer (), + guid->length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_CLIENT_SCHED_TIME, int_guid, 0, 0); Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; @@ -250,7 +251,7 @@ EDF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri) IOP::ServiceContext sc; sc.context_id = Client_Interceptor::SchedulingInfo; - CORBA::Policy_ptr sched_policy = + CORBA::Policy_var sched_policy = this->current_->scheduling_parameter(); CORBA::Long importance; @@ -285,8 +286,8 @@ EDF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri) #endif } //Fill the guid in the SC Qos struct - sc_qos.guid.length (this->current_->id ()->length ()); - guid_copy (sc_qos.guid, *(this->current_->id ())); + sc_qos.guid.length (guid->length ()); + guid_copy (sc_qos.guid, guid.in ()); sc_qos.deadline = deadline; sc_qos.importance = importance; sc_qos.task_id = task_id; @@ -294,9 +295,8 @@ EDF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri) CORBA::Any sc_qos_as_any; sc_qos_as_any <<= sc_qos; - sc.context_data = - ACE_reinterpret_cast<IOP::ServiceContext::_tao_seq_CORBA_Octet_ &> ( - *codec_->encode (sc_qos_as_any)); + CORBA::OctetSeq_var cdtmp = codec_->encode (sc_qos_as_any); + sc.context_data = cdtmp.in (); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, @@ -316,7 +316,7 @@ EDF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri) DSUI_EVENT_LOG (EDF_SCHED_FAM, CALL_KOKYU_DISPATCH_UPDATE_SCHEDULE, int_guid, 0, 0); - kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + kokyu_dispatcher_->update_schedule (guid.in (), Kokyu::BLOCK); DSUI_EVENT_LOG (EDF_SCHED_FAM, LEAVE_KOKYU_DISPATCH_UPDATE_SCHEDULE, int_guid,0,0); @@ -389,7 +389,8 @@ EDF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, sc->context_data.get_buffer (), 0); CORBA::Any sc_qos_as_any; - sc_qos_as_any = *codec_->decode (oc_seq); + CORBA::Any_var scqostmp = codec_->decode (oc_seq); + sc_qos_as_any = scqostmp.in (); //Don't store in a _var, since >>= returns a pointer to an //internal buffer and we are not supposed to free it. sc_qos_as_any >>= sc_qos_ptr; @@ -463,9 +464,10 @@ void EDF_Scheduler::send_poll (PortableInterceptor::ClientRequestInfo_ptr) { int int_guid; + RTScheduling::Current::IdType_var guid = this->current_->id (); ACE_OS::memcpy (&int_guid, - this->current_->id ()->get_buffer (), - this->current_->id ()->length ()); + guid->get_buffer (), + guid->length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, SEND_POLL, int_guid, 0, 0); } @@ -473,9 +475,10 @@ void EDF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri) { int int_guid; + RTScheduling::Current::IdType_var guid = this->current_->id (); ACE_OS::memcpy (&int_guid, - this->current_->id ()->get_buffer (), - this->current_->id ()->length ()); + guid->get_buffer (), + guid->length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_SEND_REPLY, int_guid, 0, 0); Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; @@ -496,7 +499,7 @@ EDF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri) CORBA::Long importance; TimeBase::TimeT deadline; - CORBA::Policy_ptr sched_policy = + CORBA::Policy_var sched_policy = this->current_->scheduling_parameter(); if (CORBA::is_nil (sched_policy)) @@ -522,8 +525,8 @@ EDF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri) EDF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); - sc_qos.guid.length (this->current_->id ()->length ()); - guid_copy (sc_qos.guid, *(this->current_->id ())); + sc_qos.guid.length (guid->length ()); + guid_copy (sc_qos.guid, guid.in ()); deadline = sched_param->deadline; importance = sched_param->importance; @@ -533,10 +536,8 @@ EDF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri) CORBA::Any sc_qos_as_any; sc_qos_as_any <<= sc_qos; - sc.context_data = ACE_reinterpret_cast( - IOP::ServiceContext:: - _tao_seq_CORBA_Octet_ &, - *codec_->encode (sc_qos_as_any)); + CORBA::OctetSeq_var cdtmp = codec_->encode (sc_qos_as_any); + sc.context_data = cdtmp.in (); // Add this context to the service context list. ri->add_reply_service_context (sc, 1); @@ -546,7 +547,7 @@ EDF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri) #endif } - kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + kokyu_dispatcher_->update_schedule (guid.in (), Kokyu::BLOCK); DSUI_EVENT_LOG (EDF_SCHED_FAM, EXIT_SEND_REPLY, int_guid, 0, 0); @@ -559,9 +560,10 @@ void EDF_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr ri) { int int_guid; + RTScheduling::Current::IdType_var guid = this->current_->id (); ACE_OS::memcpy (&int_guid, - this->current_->id ()->get_buffer (), - this->current_->id ()->length ()); + guid->get_buffer (), + guid->length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, SEND_EXCEPTION, int_guid, 0, 0); send_reply (ri); @@ -571,9 +573,10 @@ void EDF_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr ri) { int int_guid; + RTScheduling::Current::IdType_var guid = this->current_->id (); ACE_OS::memcpy (&int_guid, - this->current_->id ()->get_buffer (), - this->current_->id ()->length ()); + guid->get_buffer (), + guid->length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, SEND_OTHER, int_guid, 0, 0); send_reply (ri); @@ -628,7 +631,8 @@ EDF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri) //and we are not supposed to free it. Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; CORBA::Any sc_qos_as_any; - sc_qos_as_any = *codec_->decode (oc_seq); + CORBA::Any_var scqostmp = codec_->decode (oc_seq); + sc_qos_as_any = scqostmp.in (); sc_qos_as_any >>= sc_qos_ptr; deadline = sc_qos_ptr->deadline; |