diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-12-31 04:55:06 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-12-31 04:55:06 +0000 |
commit | a405dae77477f91f4ffebe91484122d9826324df (patch) | |
tree | 5075687cc7807652bbd3e8367ec23333d00f43df | |
parent | 3f1acbfc89bc6dd62f2f97c7d3b9e15bd88fa3bb (diff) | |
download | ATCD-a405dae77477f91f4ffebe91484122d9826324df.tar.gz |
.
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Runtime_Scheduler.cpp | 137 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Runtime_Scheduler.h | 39 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp | 151 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Scheduler_Factory.h | 65 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Scheduler_Factory.i | 18 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Scheduler_Utilities.cpp | 4 |
6 files changed, 214 insertions, 200 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.cpp b/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.cpp index 7b4542a3e81..f82785279ce 100644 --- a/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.cpp +++ b/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.cpp @@ -11,31 +11,29 @@ ACE_RCSID(orbsvcs, Runtime_Scheduler, "$Id$") ACE_Runtime_Scheduler:: ACE_Runtime_Scheduler (int config_count, - ACE_Scheduler_Factory::POD_Config_Info config_info[], - int entry_count, + ACE_Scheduler_Factory::POD_Config_Info config_info[], + int entry_count, ACE_Scheduler_Factory::POD_RT_Info rt_info[]) - : config_count_ (config_count) - , config_info_ (config_info) - , entry_count_ (entry_count) - , rt_info_ (rt_info) + : config_count_ (config_count), + config_info_ (config_info), + entry_count_ (entry_count), + rt_info_ (rt_info) { } RtecScheduler::handle_t -ACE_Runtime_Scheduler::create (const char * entry_point, +ACE_Runtime_Scheduler::create (const char *entry_point, + // @@ Chris, please use TAO_TRY_ENV not _env. Please fix this throughout the file. CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::DUPLICATE_NAME)) { // Just make sure it's there and return its handle. - int i; - for (i = 0; i < entry_count_; ++i) - { - if (strcmp (entry_point, rt_info_[i].entry_point) == 0) - { - return i + 1; - } - } + for (int i = 0; i < entry_count_; ++i) + if (ACE_OS::strcmp (entry_point, + rt_info_[i].entry_point) == 0) + return i + 1; + // TODO: throw an exception or print an error. return -1; } @@ -48,21 +46,21 @@ ACE_Runtime_Scheduler::lookup (const char * entry_point, return create (entry_point, _env); } -RtecScheduler::RT_Info* +RtecScheduler::RT_Info * ACE_Runtime_Scheduler::get (RtecScheduler::handle_t handle, CORBA::Environment &_env) TAO_THROW_SPEC((CORBA::SystemException, RtecScheduler::UNKNOWN_TASK)) { if (handle <= 0 || handle > entry_count_) - { - TAO_THROW_RETURN (RtecScheduler::UNKNOWN_TASK(), 0); - } - + TAO_THROW_RETURN (RtecScheduler::UNKNOWN_TASK (), + 0); // Note: there is no memory leak here, according to the CORBA spec, // we are supposed to allocate an structure and return it, the // caller owns it from then on. + // @@ Chris, please make sure to ALWAYS use the ACE_NEW_RETURN or + // ACE_NEW macros in situations like this... RtecScheduler::RT_Info* info = new RtecScheduler::RT_Info; info->entry_point = rt_info_[handle - 1].entry_point; @@ -83,6 +81,10 @@ ACE_Runtime_Scheduler::get (RtecScheduler::handle_t handle, return info; } +// @@ Chris, please reformat ALL the methods like this: +// void +// ACE_Runtime_Scheduler::nameofmethod()... + void ACE_Runtime_Scheduler::set (RtecScheduler::handle_t handle, RtecScheduler::Criticality_t criticality, RtecScheduler::Time time, @@ -115,14 +117,12 @@ void ACE_Runtime_Scheduler::set (RtecScheduler::handle_t handle, || rt_info_[handle - 1].quantum != quantum || rt_info_[handle - 1].info_type != info_type || rt_info_[handle - 1].threads != threads) - { - ACE_ERROR ((LM_ERROR, "invalid data for RT_Info: %s\n", - (const char*)rt_info_[handle - 1].entry_point)); - // TODO: throw something here. - } + ACE_ERROR ((LM_ERROR, + "invalid data for RT_Info: %s\n", + (const char*)rt_info_[handle - 1].entry_point)); + // TODO: throw something here. } - void ACE_Runtime_Scheduler::priority (RtecScheduler::handle_t handle, RtecScheduler::OS_Priority& o_priority, RtecScheduler::Preemption_Subpriority_t& subpriority, @@ -133,33 +133,33 @@ void ACE_Runtime_Scheduler::priority (RtecScheduler::handle_t handle, RtecScheduler::NOT_SCHEDULED)) { if (handle <= 0 || handle > entry_count_) - { - TAO_THROW (RtecScheduler::UNKNOWN_TASK()); - // NOTREACHED - } + TAO_THROW (RtecScheduler::UNKNOWN_TASK ()); + // NOTREACHED o_priority = rt_info_[handle - 1].priority; subpriority = rt_info_[handle - 1].static_subpriority; p_priority = rt_info_[handle - 1].preemption_priority; - // ACE_DEBUG ((LM_DEBUG, "(%t) Returning priority %d\n", priority)); } void ACE_Runtime_Scheduler::entry_point_priority (const char * entry_point, RtecScheduler::OS_Priority& priority, RtecScheduler::Preemption_Subpriority_t& subpriority, RtecScheduler::Preemption_Priority_t& p_priority, + // @@ Chris, please use the TAO_TRY_ENV macro rather than _env... CORBA::Environment &_env) - TAO_THROW_SPEC((CORBA::SystemException, - RtecScheduler::UNKNOWN_TASK, - RtecScheduler::NOT_SCHEDULED)) + TAO_THROW_SPEC ((CORBA::SystemException, + RtecScheduler::UNKNOWN_TASK, + RtecScheduler::NOT_SCHEDULED)) { RtecScheduler::handle_t handle = lookup (entry_point, _env); if (handle < -1) - { - // The exception was thrown or is in _env already. - return; - } - this->priority (handle, priority, subpriority, p_priority, _env); + // The exception was thrown or is in _env already. + return; + this->priority (handle, + priority, + subpriority, + p_priority, + _env); } void ACE_Runtime_Scheduler::add_dependency (RtecScheduler::handle_t handle, @@ -167,15 +167,15 @@ void ACE_Runtime_Scheduler::add_dependency (RtecScheduler::handle_t handle, CORBA::Long number_of_calls, RtecScheduler::Dependency_Type_t dependency_type, + // @@ Chris, please don't use _env... CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::UNKNOWN_TASK)) { if (handle <= 0 || handle > entry_count_) - { - TAO_THROW (RtecScheduler::UNKNOWN_TASK()); - // NOTREACHED - } + TAO_THROW (RtecScheduler::UNKNOWN_TASK ()); + // NOTREACHED + #if 0 // Just check that the information is consistent. RtecScheduler::Dependency_Set& deps = rt_info_[handle - 1]->dependencies; @@ -199,6 +199,7 @@ void ACE_Runtime_Scheduler::compute_scheduling (CORBA::Long minimum_priority, RtecScheduler::Config_Info_Set_out configs, RtecScheduler::Scheduling_Anomaly_Set_out anomalies, + // @@ Chris, please don't use env... CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::UTILIZATION_BOUND_EXCEEDED, @@ -211,35 +212,38 @@ void ACE_Runtime_Scheduler::compute_scheduling (CORBA::Long minimum_priority, return; } - -void ACE_Runtime_Scheduler::dispatch_configuration(RtecScheduler::Preemption_Priority_t p_priority, - RtecScheduler::OS_Priority& priority, - RtecScheduler::Dispatching_Type_t & d_type, - CORBA::Environment &_env) +void +ACE_Runtime_Scheduler::dispatch_configuration (RtecScheduler::Preemption_Priority_t p_priority, + RtecScheduler::OS_Priority& priority, + RtecScheduler::Dispatching_Type_t & d_type, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::NOT_SCHEDULED, RtecScheduler::UNKNOWN_PRIORITY_LEVEL)) { - // throw an exception if a valid schedule has not been loaded - if (config_count_ <= 0 || - config_info_ [p_priority].preemption_priority != p_priority) - { - TAO_THROW (RtecScheduler::NOT_SCHEDULED()); + // Throw an exception if a valid schedule has not been loaded + if (config_count_ <= 0 + || config_info_ [p_priority].preemption_priority != p_priority) + { + TAO_THROW (RtecScheduler::NOT_SCHEDULED ()); ACE_NOTREACHED (return); - } + } // throw an exception if an invalid priority was passed else if (p_priority < 0 || p_priority >= config_count_) - { + { TAO_THROW (RtecScheduler::UNKNOWN_PRIORITY_LEVEL()); ACE_NOTREACHED (return); - } + } else - { - priority = config_info_ [p_priority].thread_priority; - d_type = config_info_ [p_priority].dispatching_type; - return; - } + { + priority = config_info_ [p_priority].thread_priority; + d_type = config_info_ [p_priority].dispatching_type; + return; + } } + +// @@ Chris, these comments are in the wrong part of the function. They should go at the beginning, NOT the end... Please fix all these. + // provide the thread priority and queue type for the given priority level RtecScheduler::Preemption_Priority_t @@ -249,19 +253,16 @@ ACE_Runtime_Scheduler::last_scheduled_priority (CORBA::Environment &_env) { // throw an exception if a valid schedule has not been loaded if (config_count_ <= 0) - { TAO_THROW_RETURN (RtecScheduler::NOT_SCHEDULED(), - (RtecScheduler::Preemption_Priority_t) -1); - } + (RtecScheduler::Preemption_Priority_t) -1); else - { return (RtecScheduler::Preemption_Priority_t) (config_count_ - 1); - } } + // Returns the last priority number assigned to an operation in the schedule. // The number returned is one less than the total number of scheduled priorities. - // All scheduled priorities range from 0 to the number returned, inclusive. - + // All scheduled priorities range from 0 to the number returned, +inclusive. diff --git a/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.h b/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.h index 3fe6422c284..217c39eee5b 100644 --- a/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.h +++ b/TAO/orbsvcs/orbsvcs/Runtime_Scheduler.h @@ -1,5 +1,19 @@ +/* -*- C++ -*- */ // $Id$ +// ============================================================================ +// +// = LIBRARY +// orbsvcs +// +// = FILENAME +// Runtime_Scheduler.h +// +// = AUTHOR +// Chris Gill <cdgill@cs.wustl.edu> +// +// ============================================================================ + #ifndef ACE_RUNTIME_SCHEDULER_H #define ACE_RUNTIME_SCHEDULER_H @@ -16,19 +30,18 @@ class TAO_ORBSVCS_Export ACE_Runtime_Scheduler : public POA_RtecScheduler::Sched // This class offers the services of the scheduler, but based on // precomputed and precompiled information. This results in a // highly optimized execution after the configuration runs. - // public: ACE_Runtime_Scheduler (int config_count, ACE_Scheduler_Factory::POD_Config_Info config_info[], int entry_count, ACE_Scheduler_Factory::POD_RT_Info rt_info[]); - - // Initialize the data from the POD_RT_Info array. - // Only basic validation is done. + // Initialize the data from the POD_RT_Info array. Only basic + // validation is done. virtual RtecScheduler::handle_t create (const char * entry_point, CORBA::Environment &_env) - TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::DUPLICATE_NAME)); + TAO_THROW_SPEC ((CORBA::SystemException, + RtecScheduler::DUPLICATE_NAME)); virtual RtecScheduler::handle_t lookup (const char * entry_point, CORBA::Environment &_env) @@ -36,7 +49,8 @@ public: virtual RtecScheduler::RT_Info* get (RtecScheduler::handle_t handle, CORBA::Environment &_env) - TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::UNKNOWN_TASK)); + TAO_THROW_SPEC ((CORBA::SystemException, + RtecScheduler::UNKNOWN_TASK)); virtual void set (RtecScheduler::handle_t handle, RtecScheduler::Criticality_t criticality, @@ -49,7 +63,8 @@ public: CORBA::Long threads, RtecScheduler::Info_Type_t info_type, CORBA::Environment &_env) - TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::UNKNOWN_TASK)); + TAO_THROW_SPEC ((CORBA::SystemException, + RtecScheduler::UNKNOWN_TASK)); virtual void priority (RtecScheduler::handle_t handle, RtecScheduler::OS_Priority& o_priority, @@ -100,13 +115,12 @@ public: virtual RtecScheduler::Preemption_Priority_t last_scheduled_priority (CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, RtecScheduler::NOT_SCHEDULED)); - // Returns the last priority number assigned to an operation in the schedule. - // The number returned is one less than the total number of scheduled priorities. - // All scheduled priorities range from 0 to the number returned, inclusive. - + // Returns the last priority number assigned to an operation in the + // schedule. The number returned is one less than the total number + // of scheduled priorities. All scheduled priorities range from 0 + // to the number returned, inclusive. private: - int config_count_; // The number of elements in the config array. @@ -118,7 +132,6 @@ private: ACE_Scheduler_Factory::POD_RT_Info* rt_info_; // The array of precomputed RT_Info structures. - }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp index ddeb09f9858..9cca2581485 100644 --- a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp @@ -24,27 +24,30 @@ ACE_Scheduler_Factory::POD_Config_Info* TAO_SF_config_info = 0; int TAO_SF_entry_count = -1; ACE_Scheduler_Factory::POD_RT_Info* TAO_SF_rt_info = 0; - -// Helper struct, to encapsulate the singleton static server and -// ACE_TSS objects. We can't use ACE_Singleton directly, because -// construction of ACE_Runtime_Scheduler takes arguments. struct ACE_Scheduler_Factory_Data { + // = TITLE + // Helper struct, to encapsulate the singleton static server and + // ACE_TSS objects. We can't use ACE_Singleton directly, because + // construction of ACE_Runtime_Scheduler takes arguments. + ACE_Runtime_Scheduler scheduler_; // The static runtime scheduler. ACE_TSS<ACE_TSS_Type_Adapter<RtecScheduler::Preemption_Priority_t> > - preemption_priority_; + preemption_priority_; // The dispatch queue number of the calling thread. For access by // applications; must be set by either the application or Event // Channel. ACE_Scheduler_Factory_Data (void) - : scheduler_ (TAO_SF_config_count, TAO_SF_config_info, - TAO_SF_entry_count, TAO_SF_rt_info), + : scheduler_ (TAO_SF_config_count, + TAO_SF_config_info, + TAO_SF_entry_count, + TAO_SF_rt_info), preemption_priority_ () - { - } + { + } }; static ACE_Scheduler_Factory_Data *ace_scheduler_factory_data = 0; @@ -55,12 +58,10 @@ int ACE_Scheduler_Factory::use_runtime (int cc, POD_RT_Info rti[]) { if (server_ != 0 || TAO_SF_entry_count != -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "ACE_Scheduler_Factory::use_runtime - " - "server already configured\n"), -1); - } - + ACE_ERROR_RETURN ((LM_ERROR, + "ACE_Scheduler_Factory::use_runtime - " + "server already configured\n"), + -1); TAO_SF_config_count = cc; TAO_SF_config_info = cfgi; TAO_SF_entry_count = ec; @@ -71,12 +72,12 @@ int ACE_Scheduler_Factory::use_runtime (int cc, } static RtecScheduler::Scheduler_ptr -static_server () +static_server (void) { RtecScheduler::Scheduler_ptr server_ = 0; // This isn't thread safe, but the static instance that it replaces - // wasn't thread safe either. Hola, Sr. Sandiego :-) If it needs to + // wasn't thread safe either. Hola, Sr. Sandiego :-) If it needs to // be made thread safe, it should be protected using double-checked // locking. if (! ace_scheduler_factory_data && @@ -94,11 +95,10 @@ static_server () "ACE_Scheduler_Factory - configured static server\n")); } TAO_CATCHANY - { - ACE_ERROR_RETURN ((LM_ERROR, - "ACE_Scheduler_Factory::config_runtime - " - "cannot allocate server\n"), 0); - } + ACE_ERROR_RETURN ((LM_ERROR, + "ACE_Scheduler_Factory::config_runtime - " + "cannot allocate server\n"), + 0); TAO_ENDTRY; return server_; @@ -116,11 +116,9 @@ ACE_Scheduler_Factory::use_config (CosNaming::NamingContext_ptr naming, const char* name) { if (server_ != 0 || TAO_SF_entry_count != -1) - { - // No errors, runtime execution simply takes precedence over - // config runs. - return 0; - } + // No errors, runtime execution simply takes precedence over + // config runs. + return 0; TAO_TRY { @@ -128,11 +126,13 @@ ACE_Scheduler_Factory::use_config (CosNaming::NamingContext_ptr naming, schedule_name.length (1); schedule_name[0].id = CORBA::string_dup (name); CORBA::Object_var objref = - naming->resolve (schedule_name, TAO_TRY_ENV); + naming->resolve (schedule_name, + TAO_TRY_ENV); TAO_CHECK_ENV; server_ = - RtecScheduler::Scheduler::_narrow(objref.in (), TAO_TRY_ENV); + RtecScheduler::Scheduler::_narrow(objref.in (), + TAO_TRY_ENV); TAO_CHECK_ENV; } TAO_CATCHANY @@ -140,7 +140,8 @@ ACE_Scheduler_Factory::use_config (CosNaming::NamingContext_ptr naming, server_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "ACE_Scheduler_Factory::use_config - " - " exception while resolving server\n"), -1); + " exception while resolving server\n"), + -1); } TAO_ENDTRY; @@ -162,16 +163,13 @@ RtecScheduler::Scheduler_ptr ACE_Scheduler_Factory::server (void) { if (server_ == 0 && TAO_SF_entry_count != -1) - { - server_ = static_server (); - } + server_ = static_server (); if (server_ == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "ACE_Scheduler_Factor::server - " - "no scheduling service configured\n"), 0); - } + ACE_ERROR_RETURN ((LM_ERROR, + "ACE_Scheduler_Factor::server - " + "no scheduling service configured\n"), + 0); return server_; } @@ -232,32 +230,26 @@ int ACE_Scheduler_Factory::dump_schedule // Default format for printing RT_Info output. if (rt_info_format == 0) - { rt_info_format = "{%20s, %10d, %10d, %10d, " "%10d, %10d, " "(RtecScheduler::Criticality_t) %d, " "(RtecScheduler::Importance_t) %d, " "%10d, %10d, %10d, %10d, %10d, " "(RtecScheduler::Info_Type_t) %d }"; - } // Default format for printing Config_Info output. if (config_info_format == 0) - { config_info_format = " { %10d, %10d, " "(RtecScheduler::Dispatching_Type_t) %d }"; - } FILE* file = stdout; if (file_name != 0) { file = ACE_OS::fopen (file_name, "w"); if (file == 0) - { return -1; - } } - ACE_OS::fprintf(file, header); + ACE_OS::fprintf (file, header); // Indicate anomalies encountered during scheduling. @@ -287,23 +279,28 @@ int ACE_Scheduler_Factory::dump_schedule break; } - ACE_OS::fprintf (file, "%s\n", (const char*) anomaly.description); + ACE_OS::fprintf (file, + "%s\n", + (const char *) anomaly.description); } // Print out operation QoS info. - ACE_OS::fprintf(file, start_infos); - for (i = 0; i < infos.length (); ++i) + ACE_OS::fprintf (file, start_infos); + + for (i = 0; + i < infos.length (); + ++i) { if (i != 0) - { - // Finish previous line. - ACE_OS::fprintf(file, ",\n"); - } + // Finish previous line. + ACE_OS::fprintf(file, ",\n"); const RtecScheduler::RT_Info& info = infos[i]; // Put quotes around the entry point name, exactly as it is stored. - ACE_OS::sprintf (entry_point, "\"%s\"", (const char*) info.entry_point); + ACE_OS::sprintf (entry_point, + "\"%s\"", + (const char *) info.entry_point); // @@ TODO Eventually the TimeT structure will be a 64-bit // unsigned int, we will have to change this dump method then. @@ -325,26 +322,25 @@ int ACE_Scheduler_Factory::dump_schedule info.info_type); } // Finish last line. - ACE_OS::fprintf(file, "\n"); + ACE_OS::fprintf(file, + "\n"); if (infos.length () > 0) - { - ACE_OS::fprintf(file, end_infos); - } + ACE_OS::fprintf (file, end_infos); else - { - ACE_OS::fprintf(file, end_infos_empty); - } + ACE_OS::fprintf (file, end_infos_empty); // Print out queue configuration info. - ACE_OS::fprintf(file, start_configs); - for (i = 0; i < configs.length (); ++i) + ACE_OS::fprintf (file, start_configs); + + for (i = 0; + i < configs.length (); + ++i) { if (i != 0) - { - // Finish previous line. - ACE_OS::fprintf(file, ",\n"); - } + // Finish previous line. + ACE_OS::fprintf (file, ",\n"); + const RtecScheduler::Config_Info& config = configs[i]; ACE_OS::fprintf (file, config_info_format, @@ -352,19 +348,16 @@ int ACE_Scheduler_Factory::dump_schedule config.thread_priority, config.dispatching_type); } + // Finish last line. - ACE_OS::fprintf(file, "\n"); + ACE_OS::fprintf (file, "\n"); if (configs.length () > 0) - { - ACE_OS::fprintf(file, end_configs); - } + ACE_OS::fprintf (file, end_configs); else - { - ACE_OS::fprintf(file, end_configs_empty); - } + ACE_OS::fprintf (file, end_configs_empty); - ACE_OS::fprintf(file, footer); + ACE_OS::fprintf (file, footer); ACE_OS::fclose (file); return 0; } @@ -376,7 +369,7 @@ int ACE_Scheduler_Factory::dump_schedule #endif /* HPUX && !g++ */ RtecScheduler::Preemption_Priority_t -ACE_Scheduler_Factory::preemption_priority () +ACE_Scheduler_Factory::preemption_priority (void) { // Return whatever we've got. The application or Event Channel is // responsible for making sure that it was set. @@ -408,10 +401,10 @@ ACE_Scheduler_Factory::set_preemption_priority // Probably don't need this, because it should be safe to assume // that static_server () was called before this function. But just // in case . . . - if (! ace_scheduler_factory_data && - (ace_scheduler_factory_data = - ACE_Singleton<ACE_Scheduler_Factory_Data, - ACE_Null_Mutex>::instance ()) == 0) + if (!ace_scheduler_factory_data + && (ace_scheduler_factory_data = + ACE_Singleton<ACE_Scheduler_Factory_Data, + ACE_Null_Mutex>::instance ()) == 0) return; ace_scheduler_factory_data->preemption_priority_-> diff --git a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h index 0f3cb349b0a..5f08c90a8f1 100644 --- a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h @@ -1,5 +1,19 @@ +/* -*- C++ -*- */ // $Id$ +// ============================================================================ +// +// = LIBRARY +// orbsvcs +// +// = FILENAME +// Scheduler_Factory.h +// +// = AUTHOR +// Chris Gill <cdgill@cs.wustl.edu> +// +// ============================================================================ + #ifndef ACE_SCHEDULER_FACTORY_H #define ACE_SCHEDULER_FACTORY_H @@ -13,6 +27,7 @@ #include "orbsvcs/RtecSchedulerC.h" class TAO_ORBSVCS_Export ACE_Scheduler_Factory +{ // = TITLE // Factory of scheduler services. // @@ -22,9 +37,9 @@ class TAO_ORBSVCS_Export ACE_Scheduler_Factory // compute the scheduling parameters. At run-time it returns a // local server, which will use the results of the config runs to // actually do the scheduling, without incurring in RPC overheads. -{ public: - enum Factory_Status {UNINITIALIZED, CONFIG, RUNTIME}; + enum Factory_Status + { // = TITLE // Factory Status // @@ -32,7 +47,13 @@ public: // This type enumerates the possible states of the factory: // uninitialized, or in a config or runtime mode of operation. + UNINITIALIZED, + CONFIG, + RUNTIME + }; + struct POD_RT_Info + { // = TITLE // Plain Old Data for RT_Infos. // @@ -40,8 +61,8 @@ public: // This class provide us with a plain old data version of // RT_Info, this is useful for implementing static arrays or of // those. - { - const char* entry_point; + + const char *entry_point; RtecScheduler::handle_t handle; RtecScheduler::Time worst_case_execution_time; RtecScheduler::Time typical_execution_time; @@ -57,23 +78,24 @@ public: CORBA::Long info_type; }; - struct POD_Config_Info + struct POD_Config_Info + { // = TITLE // Plain Old Data for dispatch queue configuration information. // // = DESCRIPTION // This class provide us with a plain old data version of // configuration info, which is useful for implementing static arrays - // NOTE: if used in an array, the run-time scheduler requires that the - // array index match the preemption priority stored in the config info - // at that index: this is used to detect uninitialized/corrupted schedules - { + // NOTE: if used in an array, the run-time scheduler requires that the + // array index match the preemption priority stored in the config info + // at that index: this is used to detect uninitialized/corrupted schedules RtecScheduler::Preemption_Priority_t preemption_priority; RtecScheduler::OS_Priority thread_priority; RtecScheduler::Dispatching_Type_t dispatching_type; }; - struct POD_Scheduling_Anomaly + struct POD_Scheduling_Anomaly + { // = TITLE // Plain Old Data for scheduling anomaly information. // @@ -81,7 +103,7 @@ public: // This class provide us with a plain old data version of // scheduling anomalies, which is used to generate error // and warning lines in the runtime scheduling header output. - { + const char* description; RtecScheduler::Anomaly_Severity severity; }; @@ -108,9 +130,8 @@ public: // Must have been configured either using use_context() or use_data(). // // Normally use_data() is called at static elaboration time, so - // everything is automatic. - // On config runs use_context() is called from main, after - // resolve_initial_references. + // everything is automatic. On config runs use_context() is called + // from main, after resolve_initial_references. static int dump_schedule (const RtecScheduler::RT_Info_Set& infos, const RtecScheduler::Config_Info_Set& configs, @@ -125,8 +146,9 @@ public: // TODO: How to do cleanup()? Use the ACE_Object_Manager stuff? static Factory_Status status (void); - // This helper function allows the application to determine whether the - // factory is uninitialized, or in a config or runtime mode of operation. + // This helper function allows the application to determine whether + // the factory is uninitialized, or in a config or runtime mode of + // operation. // = Access the (OS independent) preemption priority of the calling thread. static RtecScheduler::Preemption_Priority_t preemption_priority (); @@ -142,12 +164,11 @@ public: protected: static int no_config_run (void); // By default this factory assumes we are runnning a config - // run. Calling this method disables that. - // Since the methods returns an int it can be used to initialize a - // static variable, hence calling it before main(); this technique - // can be used in the code emitted for the run-time scheduler, - // automagically disabling the config_run() when that code is linked - // in. + // run. Calling this method disables that. Since the methods + // returns an int it can be used to initialize a static variable, + // hence calling it before main(); this technique can be used in the + // code emitted for the run-time scheduler, automagically disabling + // the config_run() when that code is linked in. private: static RtecScheduler::Scheduler_ptr server_; diff --git a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.i b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.i index fdf6d67856c..add09220816 100644 --- a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.i +++ b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.i @@ -4,22 +4,12 @@ // // ============================================================================ +// This helper function allows the application to determine whether +// the factory is uninitialized, or in a config or runtime mode of +// operation. + ACE_INLINE ACE_Scheduler_Factory::Factory_Status ACE_Scheduler_Factory::status (void) { return status_; } - // This helper function allows the application to determine whether the - // factory is uninitialized, or in a config or runtime mode of operation. - - -// EOF - - - - - - - - - diff --git a/TAO/orbsvcs/orbsvcs/Scheduler_Utilities.cpp b/TAO/orbsvcs/orbsvcs/Scheduler_Utilities.cpp index 8bbd4f4e20b..047c3920210 100644 --- a/TAO/orbsvcs/orbsvcs/Scheduler_Utilities.cpp +++ b/TAO/orbsvcs/orbsvcs/Scheduler_Utilities.cpp @@ -1,8 +1,4 @@ -// ============================================================================ -// // $Id$ -// -// ============================================================================ #include "ace/OS.h" |