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
54 Task (ACE_Thread_Manager
&thread_manager
,
63 Task::Task (ACE_Thread_Manager
&thread_manager
,
65 : ACE_Task_Base (&thread_manager
),
66 orb_ (CORBA::ORB::_duplicate (orb
))
75 CORBA::Object_var object
=
76 this->orb_
->string_to_object (ior
);
79 test::_narrow (object
.in ());
82 this->orb_
->resolve_initial_references ("RTCurrent");
84 RTCORBA::Current_var current
=
85 RTCORBA::Current::_narrow (object
.in ());
87 // We need to set the client thread CORBA priority
88 current
->the_priority (get_implicit_thread_CORBA_priority (this->orb_
.in ()));
93 for (int i
= 0; i
!= iterations
; ++i
)
100 // Assert disappears on with optimizations on.
109 catch (const CORBA::Exception
& ex
)
111 ex
._tao_print_exception ("Exception caught:");
119 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
124 CORBA::ORB_init (argc
, argv
);
127 parse_args (argc
, argv
);
131 // Thread Manager for managing task.
132 ACE_Thread_Manager thread_manager
;
135 Task
task (thread_manager
,
138 // Task activation flags.
142 orb
->orb_core ()->orb_params ()->thread_creation_flags ();
146 task
.activate (flags
);
151 ACE_ERROR_RETURN ((LM_ERROR
,
152 "Cannot create thread with scheduling policy %s\n"
153 "because the user does not have the appropriate privileges, terminating program....\n"
154 "Check svc.conf options and/or run as root\n",
155 sched_policy_name (orb
->orb_core ()->orb_params ()->ace_sched_policy ())),
163 // Wait for task to exit.
165 thread_manager
.wait ();
166 ACE_ASSERT (result
!= -1);
168 catch (const CORBA::Exception
& ex
)
170 ex
._tao_print_exception ("Exception caught");