1 #include "FP_Scheduler.h"
2 #include "tao/RTScheduling/Request_Interceptor.h"
6 std::atomic
<long> server_guid_counter
;
9 Segment_Sched_Param_Policy::value ()
15 Segment_Sched_Param_Policy::value (RTCORBA::Priority value
)
21 Segment_Sched_Param_Policy::copy ()
23 Segment_Sched_Param_Policy
*copy
= 0;
24 ACE_NEW_THROW_EX (copy
,
25 Segment_Sched_Param_Policy
,
28 copy
->value (this->value_
);
34 Segment_Sched_Param_Policy::policy_type ()
40 Segment_Sched_Param_Policy::destroy ()
44 Fixed_Priority_Scheduler::Fixed_Priority_Scheduler (CORBA::ORB_ptr orb
)
48 CORBA::Object_var object
=
49 orb
->resolve_initial_references ("RTScheduler_Current");
52 RTScheduling::Current::_narrow (object
.in ());
54 catch (const CORBA::Exception
& ex
)
56 ex
._tao_print_exception ("Caught exception:");
60 Fixed_Priority_Scheduler::~Fixed_Priority_Scheduler ()
64 FP_Scheduling::SegmentSchedulingParameterPolicy_ptr
65 Fixed_Priority_Scheduler::create_segment_scheduling_parameter (RTCORBA::Priority segment_priority
)
67 FP_Scheduling::SegmentSchedulingParameterPolicy_ptr segment_policy
;
68 ACE_NEW_THROW_EX (segment_policy
,
69 Segment_Sched_Param_Policy
,
71 CORBA::SystemException::_tao_minor_code (
74 CORBA::COMPLETED_NO
));
76 segment_policy
->value (segment_priority
);
78 return segment_policy
;
83 Fixed_Priority_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType
&,
85 CORBA::Policy_ptr
/*sched_policy*/,
91 Fixed_Priority_Scheduler::begin_nested_scheduling_segment (const RTScheduling::Current::IdType
&guid
,
93 CORBA::Policy_ptr sched_param
,
94 CORBA::Policy_ptr implicit_sched_param
)
96 this->begin_new_scheduling_segment (guid
,
99 implicit_sched_param
);
103 Fixed_Priority_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType
&guid
,
105 CORBA::Policy_ptr sched_param
,
106 CORBA::Policy_ptr implicit_sched_param
)
108 this->begin_new_scheduling_segment (guid
,
111 implicit_sched_param
);
115 Fixed_Priority_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType
&,
121 Fixed_Priority_Scheduler::end_nested_scheduling_segment (const RTScheduling::Current::IdType
&,
129 Fixed_Priority_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr request_info
)
132 ACE_hthread_t current
;
133 ACE_Thread::self (current
);
134 if (ACE_Thread::getprio (current
, priority
) == -1)
137 ACE_DEBUG ((LM_DEBUG
,
138 "Request thread priority is %d %d\n",
140 ACE_DEFAULT_THREAD_PRIORITY
));
143 RTScheduling::Current::IdType_var guid
= this->current_
->id ();
144 IOP::ServiceContext
* srv_con
= new IOP::ServiceContext
;
145 srv_con
->context_id
= Client_Interceptor::SchedulingInfo
;
146 srv_con
->context_data
.length (sizeof (size_t));
147 ACE_OS::memcpy (srv_con
->context_data
.get_buffer (),
150 request_info
->add_request_service_context (*srv_con
,
155 Fixed_Priority_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr request_info
,
156 RTScheduling::Current::IdType_out guid_out
,
157 CORBA::String_out
/*name*/,
158 CORBA::Policy_out
/*sched_param*/,
159 CORBA::Policy_out
/*implicit_sched_param*/)
161 IOP::ServiceContext
* serv_cxt
=
162 request_info
->get_request_service_context (Server_Interceptor::SchedulingInfo
);
167 ACE_OS::memcpy (&gu_id
,
168 serv_cxt
->context_data
.get_buffer (),
169 serv_cxt
->context_data
.length ());
171 ACE_TCHAR msg
[BUFSIZ
];
172 ACE_OS::sprintf (msg
,
173 ACE_TEXT("The Guid is ")
174 ACE_SIZE_T_FORMAT_SPECIFIER
175 ACE_TEXT("\n"), gu_id
);
177 DT_TEST::instance ()->dt_creator ()->log_msg (ACE_TEXT_ALWAYS_CHAR(msg
));
179 RTScheduling::Current::IdType
* guid
= 0;
181 RTScheduling::Current::IdType
);
185 guid
->length (sizeof(size_t));
187 ACE_OS::memcpy (guid
->get_buffer (),
191 if (TAO_debug_level
> 0)
192 ACE_DEBUG ((LM_DEBUG
,
193 "Receive request The Guid is %d\n",
196 guid_out
.ptr () = guid
;
202 Fixed_Priority_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr
)
207 Fixed_Priority_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr
)
212 Fixed_Priority_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr
)
217 Fixed_Priority_Scheduler::send_poll (PortableInterceptor::ClientRequestInfo_ptr
)
222 Fixed_Priority_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr
)
227 Fixed_Priority_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr
)
232 Fixed_Priority_Scheduler::receive_other (PortableInterceptor::ClientRequestInfo_ptr
)
237 Fixed_Priority_Scheduler::cancel (const RTScheduling::Current::IdType
&)
242 Fixed_Priority_Scheduler::scheduling_policies ()
248 Fixed_Priority_Scheduler::scheduling_policies (const CORBA::PolicyList
&)
253 Fixed_Priority_Scheduler::poa_policies ()
259 Fixed_Priority_Scheduler::scheduling_discipline_name ()
264 RTScheduling::ResourceManager_ptr
265 Fixed_Priority_Scheduler::create_resource_manager (const char *,
272 Fixed_Priority_Scheduler::set_scheduling_parameter (PortableServer::Servant
&,