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
19 DT (TAO_SYNCH_MUTEX
&lock
,
26 TAO_SYNCH_CONDITION dt_cond_
;
31 class Segment_Sched_Param_Policy
:
32 public MIF_Scheduling::SegmentSchedulingParameterPolicy
,
33 public ::CORBA::LocalObject
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);
47 CORBA::Short importance_
;
50 typedef ACE_Message_Queue
<ACE_NULL_SYNCH
> DT_Message_Queue
;
53 public MIF_Scheduling::MIF_Scheduler
,
54 public ::CORBA::LocalObject
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
);
68 void resume_main (void);
70 void incr_thr_count (void);
72 virtual void begin_new_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
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
,
79 CORBA::Policy_ptr sched_param
,
80 CORBA::Policy_ptr implicit_sched_param
);
82 virtual void update_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
84 CORBA::Policy_ptr sched_param
,
85 CORBA::Policy_ptr implicit_sched_param
);
87 virtual void end_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
90 virtual void end_nested_scheduling_segment (const RTScheduling::Current::IdType
& guid
,
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
,
131 CORBA::Policy_ptr scheduling_parameter
);
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_
;
143 #endif //MIF_SCHEDULER_H