1 #include "ace/Sched_Params.h"
2 #include "tao/ORB_Core.h"
4 #include "tao/RTCORBA/Priority_Mapping_Manager.h"
5 #include "tao/Protocols_Hooks.h"
8 sched_policy_name (int sched_policy
)
29 check_supported_priorities (CORBA::ORB_ptr orb
)
32 orb
->orb_core ()->orb_params ()->ace_sched_policy ();
34 // Check that we have sufficient priority range to run this test,
35 // i.e., more than 1 priority level.
37 ACE_Sched_Params::priority_max (sched_policy
);
39 ACE_Sched_Params::priority_min (sched_policy
);
41 if (max_priority
== min_priority
)
44 "Not enough priority levels with the %C scheduling policy\n"
45 "on this platform to run the test, terminating program....\n"
46 "Check svc.conf options\n",
47 sched_policy_name (sched_policy
)));
56 get_implicit_thread_CORBA_priority (CORBA::ORB_ptr orb
)
58 CORBA::Object_var obj
=
59 orb
->resolve_initial_references (TAO_OBJID_PRIORITYMAPPINGMANAGER
);
61 TAO_Priority_Mapping_Manager_var mapping_manager
=
62 TAO_Priority_Mapping_Manager::_narrow (obj
.in ());
64 if (CORBA::is_nil (mapping_manager
.in ()))
65 throw CORBA::INTERNAL ();
67 RTCORBA::PriorityMapping
*pm
=
68 mapping_manager
.in ()->mapping ();
70 TAO_Protocols_Hooks
*tph
=
71 orb
->orb_core ()->get_protocols_hooks ();
73 CORBA::Short corba_priority
;
74 CORBA::Short native_priority
;
76 if (tph
->get_thread_native_priority (native_priority
) == 0 &&
77 pm
->to_CORBA (native_priority
, corba_priority
))
79 return corba_priority
;
82 ACE_DEBUG ((LM_DEBUG
, "get_implicit_thread_CORBA_priority - failed to access priority\n"));
83 throw CORBA::DATA_CONVERSION (CORBA::OMGVMCID
| 2, CORBA::COMPLETED_NO
);