From aaec0cdaa21eb54f86c7de9d363195f1e8fee64e Mon Sep 17 00:00:00 2001 From: huangming Date: Tue, 20 Jan 2004 20:44:47 +0000 Subject: Remove RT_Task --- .../AMI_Primary_Replication_Strategy.cpp | 3 +- .../FtRtEvent/EventChannel/Fault_Detector.cpp | 3 +- TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.cpp | 80 ---------------------- TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.h | 24 ------- 4 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.h diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/AMI_Primary_Replication_Strategy.cpp b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/AMI_Primary_Replication_Strategy.cpp index ac687b61bd9..8c04b39de49 100644 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/AMI_Primary_Replication_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/AMI_Primary_Replication_Strategy.cpp @@ -12,7 +12,6 @@ #include "../Utils/resolve_init.h" #include "../Utils/ScopeGuard.h" #include "../Utils/Log.h" -#include "../Utils/RT_Task.h" ACE_RCSID (EventChannel, AMI_Primary_Replication_Strategy, @@ -47,7 +46,7 @@ int AMI_Primary_Replication_Strategy::release (void) int AMI_Primary_Replication_Strategy::init() { - return RT_Task::activate(this); + return this->activate(); } int AMI_Primary_Replication_Strategy::svc() diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Fault_Detector.cpp b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Fault_Detector.cpp index 2f85db8b337..e246a79d936 100644 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Fault_Detector.cpp +++ b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Fault_Detector.cpp @@ -3,7 +3,6 @@ #include "ace/Reactor.h" #include "Fault_Detector.h" #include "ace/Select_Reactor.h" -#include "../Utils/RT_Task.h" ACE_RCSID (EventChannel, Fault_Detector, @@ -48,7 +47,7 @@ int Fault_Detector::init(int argc, char** argv) this->init_acceptor() ==0) { if (!reactor_task_.thr_count() && - RT_Task::activate(&reactor_task_) != 0) + reactor_task_.activate() != 0) ACE_ERROR_RETURN ((LM_ERROR,"Cannot activate reactor thread\n"), -1); return 0; diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.cpp b/TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.cpp deleted file mode 100644 index 1ee993b34fc..00000000000 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//$Id$ -#include "RT_Task.h" -#include "ace/Task.h" -#include "ace/Sched_Params.h" - -namespace { - bool enable_rt_class; -}; - -void RT_Task::enable() -{ - enable_rt_class = true; - ACE_hthread_t thr_handle; - ACE_Thread::self (thr_handle); - long prio = ACE_Sched_Params::priority_max(ACE_SCHED_FIFO); - if (ACE_OS::thr_setprio(thr_handle, prio, ACE_SCHED_FIFO) == -1){ - ACE_DEBUG((LM_DEBUG, "Cannot set the thread to RT class\n")); - } -} - -int RT_Task::activate(ACE_Task_Base* task) -{ - if (enable_rt_class) { - long priority = ACE_Sched_Params::priority_max(ACE_SCHED_FIFO); - long flags = THR_NEW_LWP; - - // To get FIFO scheduling with PTHREADS. - ACE_SET_BITS (flags, - THR_SCHED_FIFO); - - // Become an active object. - if (task->activate (flags, - 1, - 0, - priority) == -1) - { - ACE_DEBUG((LM_DEBUG, "Cannot activate the thread in RT class\n")); - - // On Linux, for example, only the superuser can set the policy - // to other than ACE_SCHED_OTHER. But with ACE_SCHED_OTHER, - // there is only one thread priority value, for example, 0. So, - // let the superuser run an interesting test, but for other - // users use the minimum ACE_SCHED_OTHER thread priority. - - long fallback_priority = - ACE_Sched_Params::priority_min (ACE_SCHED_OTHER, - ACE_SCOPE_THREAD); - - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%t) task activation at priority %d with ") - ACE_TEXT ("flags 0x%X failed; retry at priority %d with ") - ACE_TEXT ("flags 0x%X (errno is %d%p)\n"), - priority, - flags, - fallback_priority, - THR_NEW_LWP, - errno, - ACE_TEXT (""))); - - flags = THR_NEW_LWP; - priority = fallback_priority; - - if (task->activate (flags, - 1, - 1, - priority) == -1) - { - - ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("(%t) task activation at priority %d failed, ") - ACE_TEXT ("exiting!\n%a"), - priority, - -1)); - } - } - return 0; - } - else - return task->activate(); -} diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.h b/TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.h deleted file mode 100644 index 1a9de596ad5..00000000000 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/RT_Task.h +++ /dev/null @@ -1,24 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file RT_Task.h - * - * $Id$ - * - * @author Huang-Ming Huang - */ -//============================================================================= -#ifndef RT_TASK_H -#define RT_TASK_H -#include "ftrtevent_export.h" - -class ACE_Task_Base; - -class TAO_FtRtEvent_Export RT_Task -{ -public: - static void enable(); - static int activate(ACE_Task_Base*); -}; - -#endif -- cgit v1.2.1