Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / examples / RTScheduling / MIF_Scheduler / MIF_Scheduler.h
blobea546dc40e99a3a94c999cb57c0843d38f42bb1f
1 #ifndef MIF_SCHEDULER_H
2 #define MIF_SCHEDULER_H
4 #include "../MIF_SchedulingC.h"
6 #include "tao/orbconf.h"
7 #include "tao/LocalObject.h"
8 #include "tao/RTScheduling/RTScheduler.h"
9 #include "tao/RTCORBA/Priority_Mapping_Manager.h"
11 #include "ace/Message_Queue.h"
12 #include "ace/Null_Condition.h"
13 #include "ace/Condition_Thread_Mutex.h"
14 #include "ace/Synch_Traits.h"
16 class DT : public ACE_Message_Block
18 public:
19 DT (TAO_SYNCH_MUTEX &lock,
20 int guid);
22 void suspend (void);
23 void resume (void);
25 private:
26 TAO_SYNCH_CONDITION dt_cond_;
27 int guid_;
28 int eligible_;
31 class Segment_Sched_Param_Policy:
32 public MIF_Scheduling::SegmentSchedulingParameterPolicy,
33 public ::CORBA::LocalObject
35 public:
36 virtual CORBA::Short importance (void);
38 virtual void importance (CORBA::Short importance);
40 CORBA::Policy_ptr copy (void);
42 virtual CORBA::PolicyType policy_type (void);
44 void destroy (void);
46 private:
47 CORBA::Short importance_;
50 typedef ACE_Message_Queue<ACE_NULL_SYNCH> DT_Message_Queue;
52 class MIF_Scheduler:
53 public MIF_Scheduling::MIF_Scheduler,
54 public ::CORBA::LocalObject
56 public:
58 MIF_Scheduler (CORBA::ORB_ptr orb);
60 ~MIF_Scheduler (void);
63 virtual MIF_Scheduling::SegmentSchedulingParameterPolicy_ptr
64 create_segment_scheduling_parameter (CORBA::Short segment_priority);
66 void wait (void);
68 void resume_main (void);
70 void incr_thr_count (void);
72 virtual void begin_new_scheduling_segment (const RTScheduling::Current::IdType & guid,
73 const char * name,
74 CORBA::Policy_ptr sched_param,
75 CORBA::Policy_ptr implicit_sched_param);
77 virtual void begin_nested_scheduling_segment (const RTScheduling::Current::IdType & guid,
78 const char * name,
79 CORBA::Policy_ptr sched_param,
80 CORBA::Policy_ptr implicit_sched_param);
82 virtual void update_scheduling_segment (const RTScheduling::Current::IdType & guid,
83 const char * name,
84 CORBA::Policy_ptr sched_param,
85 CORBA::Policy_ptr implicit_sched_param);
87 virtual void end_scheduling_segment (const RTScheduling::Current::IdType & guid,
88 const char * name);
90 virtual void end_nested_scheduling_segment (const RTScheduling::Current::IdType & guid,
91 const char * name,
92 CORBA::Policy_ptr outer_sched_param);
94 virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri);
96 virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri,
97 RTScheduling::Current::IdType_out guid,
98 CORBA::String_out name,
99 CORBA::Policy_out sched_param,
100 CORBA::Policy_out implicit_sched_param);
102 virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri);
104 virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri);
106 virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri);
108 virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri);
110 virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri);
112 virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri);
114 virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri);
116 virtual void cancel (const RTScheduling::Current::IdType & guid);
118 virtual CORBA::PolicyList * scheduling_policies (void);
120 virtual void scheduling_policies (const CORBA::PolicyList & scheduling_policies);
122 virtual CORBA::PolicyList * poa_policies (void);
124 virtual char * scheduling_discipline_name (void);
126 virtual RTScheduling::ResourceManager_ptr create_resource_manager (const char * name,
127 CORBA::Policy_ptr scheduling_parameter);
129 virtual void set_scheduling_parameter (PortableServer::Servant & resource,
130 const char * name,
131 CORBA::Policy_ptr scheduling_parameter);
133 private:
134 RTScheduling::Current_var current_;
135 RTCORBA::PriorityMappingManager_var mapping_manager_;
136 TAO_SYNCH_MUTEX lock_;
137 TAO_SYNCH_CONDITION wait_cond_;
138 DT_Message_Queue ready_que_;
139 DT_Message_Queue free_que_;
140 int wait_;
143 #endif //MIF_SCHEDULER_H