1 #include "ace/Get_Opt.h"
3 #include "tao/RTCORBA/RTCORBA.h"
4 #include "tao/ORB_Core.h"
6 #include "ace/OS_NS_unistd.h"
7 #include "../check_supported_priorities.cpp"
9 const ACE_TCHAR
*ior
= ACE_TEXT("file://ior_1");
11 int shutdown_server
= 0;
14 parse_args (int argc
, ACE_TCHAR
*argv
[])
16 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("xk:i:"));
19 while ((c
= get_opts ()) != -1)
27 ior
= get_opts
.opt_arg ();
31 iterations
= ACE_OS::atoi (get_opts
.opt_arg ());
36 ACE_ERROR_RETURN ((LM_ERROR
,
40 "-x [shutdown server] "
46 // Indicates successful parsing of the command line
50 class Task
: public ACE_Task_Base
53 Task (ACE_Thread_Manager
&thread_manager
,
61 Task::Task (ACE_Thread_Manager
&thread_manager
,
63 : ACE_Task_Base (&thread_manager
),
64 orb_ (CORBA::ORB::_duplicate (orb
))
73 CORBA::Object_var object
=
74 this->orb_
->string_to_object (ior
);
77 test::_narrow (object
.in ());
80 this->orb_
->resolve_initial_references ("RTCurrent");
82 RTCORBA::Current_var current
=
83 RTCORBA::Current::_narrow (object
.in ());
85 // We need to set the client thread CORBA priority
86 current
->the_priority (get_implicit_thread_CORBA_priority (this->orb_
.in ()));
91 for (int i
= 0; i
!= iterations
; ++i
)
98 // Assert disappears on with optimizations on.
107 catch (const CORBA::Exception
& ex
)
109 ex
._tao_print_exception ("Exception caught:");
117 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
122 CORBA::ORB_init (argc
, argv
);
125 parse_args (argc
, argv
);
129 // Thread Manager for managing task.
130 ACE_Thread_Manager thread_manager
;
133 Task
task (thread_manager
,
136 // Task activation flags.
140 orb
->orb_core ()->orb_params ()->thread_creation_flags ();
144 task
.activate (flags
);
149 ACE_ERROR_RETURN ((LM_ERROR
,
150 "Cannot create thread with scheduling policy %s\n"
151 "because the user does not have the appropriate privileges, terminating program....\n"
152 "Check svc.conf options and/or run as root\n",
153 sched_policy_name (orb
->orb_core ()->orb_params ()->ace_sched_policy ())),
161 // Wait for task to exit.
163 thread_manager
.wait ();
164 ACE_ASSERT (result
!= -1);
166 catch (const CORBA::Exception
& ex
)
168 ex
._tao_print_exception ("Exception caught");