diff options
author | venkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-11 22:45:21 +0000 |
---|---|---|
committer | venkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-11 22:45:21 +0000 |
commit | 4d075c07e00e450263ea0d89b97a757e582cc1f1 (patch) | |
tree | 390cb6ad367f8a27e3d701d556c96f92cd119b51 /Kokyu | |
parent | 639c1658874984d1411ef7ba2834e23c212d9569 (diff) | |
download | ATCD-4d075c07e00e450263ea0d89b97a757e582cc1f1.tar.gz |
ChangeLogTag: Sat Oct 11 17:39:09 2003 Venkita Subramonian <venkita@cs.wustl.edu>
Diffstat (limited to 'Kokyu')
-rw-r--r-- | Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp | 60 | ||||
-rw-r--r-- | Kokyu/DSRT_Direct_Dispatcher_Impl_T.cpp | 78 | ||||
-rw-r--r-- | Kokyu/Dispatcher_Task.h | 2 | ||||
-rw-r--r-- | Kokyu/Dispatcher_Task.i | 9 |
4 files changed, 75 insertions, 74 deletions
diff --git a/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp b/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp index ab5561d8ee3..737ec3e105b 100644 --- a/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp +++ b/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp @@ -69,7 +69,9 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) ACE_hthread_t thr_handle; ACE_Thread::self (thr_handle); - if (ACE_OS::thr_setprio (thr_handle, blocked_prio_, sched_policy_) == -1) + if (ACE_OS::thr_setprio (thr_handle, + this->blocked_prio_, + this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), @@ -81,12 +83,12 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) -1); item->thread_handle (thr_handle); - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, synch_lock_, -1); - if (ready_queue_.insert (item) == -1) + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->synch_lock_, -1); + if (this->ready_queue_.insert (item) == -1) return -1; #ifdef KOKYU_DSRT_LOGGING - ready_queue_.dump (); + this->ready_queue_.dump (); ACE_DEBUG ((LM_DEBUG, "(%t|%T):schedule_i after ready_q.insert\n")); @@ -95,7 +97,7 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) DSRT_Dispatch_Item_var<DSRT_Scheduler_Traits> item_var; ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, cond_guard, run_cond_lock_, -1); - ready_queue_.most_eligible (item_var); + this->ready_queue_.most_eligible (item_var); guard.release (); @@ -107,13 +109,13 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) thr_handle)); ACE_DEBUG ((LM_DEBUG, "(%t|%T):curr scheduled thr handle = %d\n", - curr_scheduled_thr_handle_)); + this->curr_scheduled_thr_handle_)); ACE_DEBUG ((LM_DEBUG, "(%t|%T):most eligible thr handle = %d \n", most_eligible_thr_handle)); #endif - if (curr_scheduled_thr_handle_ == thr_handle && + if (this->curr_scheduled_thr_handle_ == thr_handle && most_eligible_thr_handle != thr_handle) { #ifdef KOKYU_DSRT_LOGGING @@ -122,9 +124,9 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) "most eligible thr handle != curr thr handle. " "about to do a broadcast on CV to wake up most eligible\n")); #endif - curr_scheduled_thr_handle_ = most_eligible_thr_handle; + this->curr_scheduled_thr_handle_ = most_eligible_thr_handle; //wake up the most eligible thread - run_cond_.broadcast (); + this->run_cond_.broadcast (); } //if the current thread is not the most eligible, then wait. @@ -132,8 +134,8 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) //scheduled currently, then wait. while (most_eligible_thr_handle != thr_handle || (most_eligible_thr_handle == thr_handle && - curr_scheduled_thr_handle_ != thr_handle && - curr_scheduled_thr_handle_ != 0)) + this->curr_scheduled_thr_handle_ != thr_handle && + this->curr_scheduled_thr_handle_ != 0)) { ACE_Time_Value tv (60,0); tv += ACE_OS::gettimeofday (); @@ -142,16 +144,16 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) ACE_DEBUG ((LM_DEBUG, "(%t|%T): About to block on cv\n")); #endif - if (run_cond_.wait (&tv) == -1) + if (this->run_cond_.wait (&tv) == -1) { ACE_ERROR ((LM_ERROR, "(%t|%T): run_cond.wait timed out -- Possible Lockup\n")); } - ready_queue_.most_eligible (item_var); + this->ready_queue_.most_eligible (item_var); most_eligible_thr_handle = item_var->thread_handle (); } - curr_scheduled_guid_ = item_var->guid (); - curr_scheduled_thr_handle_ = most_eligible_thr_handle; + this->curr_scheduled_guid_ = item_var->guid (); + this->curr_scheduled_thr_handle_ = most_eligible_thr_handle; #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, @@ -159,7 +161,9 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) thr_handle)); #endif - if (ACE_OS::thr_setprio (thr_handle, active_prio_, sched_policy_) == -1) + if (ACE_OS::thr_setprio (thr_handle, + this->active_prio_, + this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), @@ -185,7 +189,7 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: update_schedule_i (Guid_t guid, Block_Flag_t flag) { - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, synch_lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->synch_lock_, -1); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t): update schedule for block entered\n")); @@ -213,7 +217,9 @@ update_schedule_i (Guid_t guid, Block_Flag_t flag) ACE_DEBUG ((LM_DEBUG, "(%t|%T): update schedule: %d found\n", thr_handle)); #endif - if (ACE_OS::thr_setprio (thr_handle, blocked_prio_, sched_policy_) == -1) + if (ACE_OS::thr_setprio (thr_handle, + this->blocked_prio_, + this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), @@ -240,7 +246,7 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: cancel_schedule_i (Guid_t guid) { - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, synch_lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->synch_lock_, -1); ACE_hthread_t thr_handle; ACE_Thread::self (thr_handle); @@ -249,21 +255,21 @@ cancel_schedule_i (Guid_t guid) ACE_DEBUG ((LM_DEBUG, "(%t|%T): about to remove guid\n")); #endif - ready_queue_.remove (guid); + this->ready_queue_.remove (guid); #ifdef KOKYU_DSRT_LOGGING - ready_queue_.dump (); + this->ready_queue_.dump (); #endif - if (curr_scheduled_thr_handle_ == thr_handle) + if (this->curr_scheduled_thr_handle_ == thr_handle) { - curr_scheduled_guid_ = 0; - curr_scheduled_thr_handle_ = 0; + this->curr_scheduled_guid_ = 0; + this->curr_scheduled_thr_handle_ = 0; } ACE_GUARD_RETURN (cond_lock_t, - mon, run_cond_lock_, 0); - run_cond_.broadcast (); + mon, this->run_cond_lock_, 0); + this->run_cond_.broadcast (); return 0; } @@ -271,7 +277,7 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: shutdown_i () { - shutdown_flagged_ = 1; + this->shutdown_flagged_ = 1; return 0; } diff --git a/Kokyu/DSRT_Direct_Dispatcher_Impl_T.cpp b/Kokyu/DSRT_Direct_Dispatcher_Impl_T.cpp index 0087f9d3952..2d3c996a23d 100644 --- a/Kokyu/DSRT_Direct_Dispatcher_Impl_T.cpp +++ b/Kokyu/DSRT_Direct_Dispatcher_Impl_T.cpp @@ -47,12 +47,12 @@ DSRT_Direct_Dispatcher_Impl (ACE_Sched_Params::Policy sched_policy, sched_queue_modified_cond_ (sched_queue_modified_cond_lock_) { //Run scheduler thread at highest priority - if (this->activate (rt_thr_flags_, 1, 0, executive_prio_) == -1) + if (this->activate (this->rt_thr_flags_, 1, 0, this->executive_prio_) == -1) { ACE_ERROR ((LM_ERROR, "(%t|%T) cannot activate scheduler thread in RT mode." "Trying in non RT mode\n")); - if (this->activate (non_rt_thr_flags_) == -1) + if (this->activate (this->non_rt_thr_flags_) == -1) ACE_ERROR ((LM_ERROR, "(%t|%T) cannot activate scheduler thread\n")); } @@ -107,7 +107,7 @@ DSRT_Direct_Dispatcher_Impl<DSRT_Scheduler_Traits>::svc (void) ACE_GUARD_RETURN (cond_lock_t, mon, sched_queue_modified_cond_lock_, 0); - if (shutdown_flagged_) + if (this->shutdown_flagged_) break; while (!sched_queue_modified_) @@ -125,53 +125,55 @@ DSRT_Direct_Dispatcher_Impl<DSRT_Scheduler_Traits>::svc (void) sched_queue_modified_ = 0; - ACE_Guard<ACE_SYNCH_RECURSIVE_MUTEX> synch_lock_mon(synch_lock_); - if (ready_queue_.current_size () <= 0) + ACE_Guard<ACE_SYNCH_RECURSIVE_MUTEX> synch_lock_mon(this->synch_lock_); + if (this->ready_queue_.current_size () <= 0) continue; #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):Sched Queue contents===>\n")); - ready_queue_.dump (); + this->ready_queue_.dump (); #endif DSRT_Dispatch_Item_var<DSRT_Scheduler_Traits> item_var; - ready_queue_.most_eligible (item_var); + this->ready_queue_.most_eligible (item_var); ACE_hthread_t most_eligible_thr_handle = item_var->thread_handle (); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):curr scheduled thr handle = %d\n", - curr_scheduled_thr_handle_)); + this->curr_scheduled_thr_handle_)); ACE_DEBUG ((LM_DEBUG, "(%t|%T):most eligible thr handle = %d \n", most_eligible_thr_handle)); #endif - if (curr_scheduled_thr_handle_ != most_eligible_thr_handle) + if (this->curr_scheduled_thr_handle_ != most_eligible_thr_handle) { - if (curr_scheduled_thr_handle_ != 0) + if (this->curr_scheduled_thr_handle_ != 0) { - if (ACE_OS::thr_setprio (curr_scheduled_thr_handle_, - inactive_prio_, sched_policy_) == -1) + if (ACE_OS::thr_setprio (this->curr_scheduled_thr_handle_, + this->inactive_prio_, + this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("thr_setprio on curr_scheduled_thr_handle_ failed."))); ACE_DEBUG ((LM_DEBUG, "thr_handle = %d, prio = %d\n", - curr_scheduled_thr_handle_, inactive_prio_)); + this->curr_scheduled_thr_handle_, + this->inactive_prio_)); } } if (ACE_OS::thr_setprio (most_eligible_thr_handle, - active_prio_, sched_policy_) == -1) + this->active_prio_, this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("thr_setprio on most_eligible_thr_handle failed"))); } - curr_scheduled_thr_handle_ = most_eligible_thr_handle; - curr_scheduled_guid_ = item_var->guid (); + this->curr_scheduled_thr_handle_ = most_eligible_thr_handle; + this->curr_scheduled_guid_ = item_var->guid (); } } @@ -202,7 +204,7 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) -1); item->thread_handle (thr_handle); - if (ready_queue_.insert (item) == -1) + if (this->ready_queue_.insert (item) == -1) return -1; #ifdef KOKYU_DSRT_LOGGING @@ -210,7 +212,9 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) "(%t|%T):schedule_i after ready_q.insert\n")); #endif - if (ACE_OS::thr_setprio (thr_handle, blocked_prio_, sched_policy_) == -1) + if (ACE_OS::thr_setprio (thr_handle, + this->blocked_prio_, + this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), @@ -227,15 +231,15 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) //@@ Perhaps the lock could be moved further down just before //setting the condition variable? ACE_GUARD_RETURN (cond_lock_t, - mon, sched_queue_modified_cond_lock_, 0); + mon, this->sched_queue_modified_cond_lock_, 0); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):schedule_i after acquiring cond lock\n")); #endif - sched_queue_modified_ = 1; - sched_queue_modified_cond_.signal (); + this->sched_queue_modified_ = 1; + this->sched_queue_modified_cond_.signal (); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, @@ -256,7 +260,7 @@ template <class DSRT_Scheduler_Traits> int DSRT_Direct_Dispatcher_Impl<DSRT_Scheduler_Traits>:: update_schedule_i (Guid_t guid, Block_Flag_t flag) { - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, synch_lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->synch_lock_, -1); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t): update schedule for block entered\n")); @@ -273,7 +277,9 @@ update_schedule_i (Guid_t guid, Block_Flag_t flag) if (found == 0 && flag == BLOCK) { thr_handle = dispatch_item->thread_handle (); - if (ACE_OS::thr_setprio (thr_handle, blocked_prio_, sched_policy_) == -1) + if (ACE_OS::thr_setprio (thr_handle, + this->blocked_prio_, + this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), @@ -306,28 +312,28 @@ template <class DSRT_Scheduler_Traits> int DSRT_Direct_Dispatcher_Impl<DSRT_Scheduler_Traits>:: cancel_schedule_i (Guid_t guid) { - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, synch_lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->synch_lock_, -1); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t): about to remove guid\n")); #endif - ready_queue_.remove (guid); + this->ready_queue_.remove (guid); #ifdef KOKYU_DSRT_LOGGING - ready_queue_.dump (); + this->ready_queue_.dump (); #endif - if (curr_scheduled_guid_ == guid) + if (this->curr_scheduled_guid_ == guid) { - curr_scheduled_guid_ = 0; - curr_scheduled_thr_handle_ = 0; + this->curr_scheduled_guid_ = 0; + this->curr_scheduled_thr_handle_ = 0; } ACE_GUARD_RETURN (cond_lock_t, - mon, sched_queue_modified_cond_lock_, 0); - sched_queue_modified_ = 1; - sched_queue_modified_cond_.signal (); + mon, this->sched_queue_modified_cond_lock_, 0); + this->sched_queue_modified_ = 1; + this->sched_queue_modified_cond_.signal (); return 0; } @@ -335,11 +341,11 @@ template <class DSRT_Scheduler_Traits> int DSRT_Direct_Dispatcher_Impl<DSRT_Scheduler_Traits>:: shutdown_i () { - shutdown_flagged_ = 1; + this->shutdown_flagged_ = 1; - ACE_Guard<cond_lock_t> mon(sched_queue_modified_cond_lock_); - sched_queue_modified_ = 1; - sched_queue_modified_cond_.signal (); + ACE_Guard<cond_lock_t> mon(this->sched_queue_modified_cond_lock_); + this->sched_queue_modified_ = 1; + this->sched_queue_modified_cond_.signal (); // We have to wait until the scheduler executive thread shuts // down. But we have acquired the lock and if we wait without // releasing it, the scheduler thread will try to acquire it after diff --git a/Kokyu/Dispatcher_Task.h b/Kokyu/Dispatcher_Task.h index 0c57b38c952..09be9974140 100644 --- a/Kokyu/Dispatcher_Task.h +++ b/Kokyu/Dispatcher_Task.h @@ -28,8 +28,6 @@ namespace Kokyu class Dispatch_Queue_Item : public ACE_Message_Block { public: - Dispatch_Queue_Item (const Dispatch_Command* , const QoSDescriptor&); - Dispatch_Queue_Item ( const Dispatch_Command* cmd, const QoSDescriptor& qos_info, diff --git a/Kokyu/Dispatcher_Task.i b/Kokyu/Dispatcher_Task.i index 80987e3fd9a..e663509d86b 100644 --- a/Kokyu/Dispatcher_Task.i +++ b/Kokyu/Dispatcher_Task.i @@ -48,15 +48,6 @@ Dispatcher_Task::get_curr_config_info() const ACE_INLINE Dispatch_Queue_Item::Dispatch_Queue_Item ( const Dispatch_Command* cmd, - const QoSDescriptor& qos_info) - :command_ (cmd), qos_info_ (qos_info) -{ - this->init_i (qos_info); -} - -ACE_INLINE -Dispatch_Queue_Item::Dispatch_Queue_Item ( - const Dispatch_Command* cmd, const QoSDescriptor& qos_info, ACE_Data_Block *data_block, int flags, |