Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / examples / RTScheduling / DT_Creator.h
blob90b818f2babd0de257ed06655f3791822c1293b3
1 #ifndef DT_CREATOR_H
2 #define DT_CREATOR_H
4 #include "POA_Holder.h"
5 #include "Job_i.h"
6 #include "Synch_i.h"
7 #include "rtschedtestlib_export.h"
9 #include "tao/RTScheduling/RTScheduler.h"
10 #include "orbsvcs/CosNamingC.h"
12 #include "ace/Service_Config.h"
13 #include "ace/Service_Object.h"
14 #include "ace/Arg_Shifter.h"
15 #include "ace/High_Res_Timer.h"
17 class Thread_Task;
18 class Task;
20 typedef Thread_Task **DT_LIST;
21 typedef POA_Holder **POA_LIST;
22 typedef Job_i **JOB_LIST;
24 class RTSCHEDTESTLIB_Export DT_Creator : public ACE_Service_Object
26 public:
27 DT_Creator ();
29 virtual ~DT_Creator ();
31 int init (int argc, ACE_TCHAR *argv []);
33 int dt_task_init (ACE_Arg_Shifter& arg_shifter);
35 virtual void create_distributable_threads (RTScheduling::Current_ptr current);
37 void activate_poa_list ();
38 void activate_job_list ();
39 void activate_schedule ();
41 virtual void yield (time_t suspend_time,
42 Thread_Task* task) = 0;
44 virtual void wait () = 0;
46 virtual CORBA::Policy_ptr sched_param (int importance) = 0;
48 virtual Thread_Task* create_thr_task (int importance,
49 time_t start_time,
50 int load,
51 int iter,
52 int dist,
53 char *job_name) = 0;
54 // virtual Task* task () = 0;
56 /// Resolve the naming service.
57 int resolve_naming_service ();
59 int dt_count ();
61 void dt_ended ();
62 void job_ended ();
64 void check_ifexit ();
66 void log_msg (char* msg);
68 void orb (CORBA::ORB_ptr);
69 CORBA::ORB_ptr orb ();
71 ACE_Time_Value* base_time ();
72 void base_time (ACE_Time_Value*);
74 ACE_hrtime_t base_hr_time ();
76 virtual int total_load () = 0;
78 Synch_i* synch ();
80 void register_synch_obj ();
82 int activate_root_poa ();
84 protected:
85 DT_LIST dt_list_;
86 POA_LIST poa_list_;
87 JOB_LIST job_list_;
88 //Fixed_Priority_Scheduler* scheduler_;
89 int dt_count_;
90 int poa_count_;
91 int job_count_;
92 CORBA::ORB_var orb_;
93 /// Mutex to serialize access to our internal state.
94 ACE_Lock* state_lock_;
95 ACE_Lock* shutdown_lock_;
96 int active_dt_count_;
97 int active_job_count_;
98 char** log;
99 ACE_Time_Value* base_time_;
100 /// A naming context.
101 CosNaming::NamingContextExt_var naming_;
102 ACE_TString file_name_;
103 ACE_TString log_file_name_;
104 ACE_High_Res_Timer::global_scale_factor_type gsf_;
105 PortableServer::Servant_var<Synch_i> synch_;
109 #endif /*DT_CREATOR_H*/