2 #include "MT_AMH_Server.h"
3 #include "tao/Strategies/advanced_resource.h"
6 #include "ace/Get_Opt.h"
8 MT_AMH_Server::MT_AMH_Server (int &argc
, ACE_TCHAR
**argv
)
9 : Base_Server (argc
, argv
)
13 MT_AMH_Server::~MT_AMH_Server (void)
18 MT_AMH_Server::usage (const char *message
)
20 static const char * usage
=
21 "invoke as: mt_server -o <ior_output_file>\n"
23 "-s <sleep_time (in microseconds)>\n";
25 // @@ Mayur, why don't you just place the usage message directly in
26 // the below ACE_ERROR macro? It's not a big deal. It's just
27 // something we normally do.
29 // Mayur: Seems cleaner to me this way.
30 ACE_ERROR ((LM_ERROR
, "%C : %C", message
, usage
));
35 MT_AMH_Server::parse_args (void)
38 // Let the base server parse it's argumrents first
39 if (Base_Server::parse_args () != 1)
45 ACE_Get_Opt
get_opts (this->argc_
, this->argv_
, ACE_TEXT("n:"));
49 while ((c
= get_opts ()) != -1)
56 this->nthreads_
= ACE_OS::atoi (get_opts
.opt_arg ());
59 // Added unneeded '{ & }' just to satisfy Win32
60 for (int i
= count_argv
; i
<= this->argc_
; ++i
)
61 this->argv_
[i
] = this->argv_
[i
+2];
64 // Decrement the value of this->argc_ to reflect the removal
66 this->argc_
= this->argc_
- 2;
80 MT_AMH_Server::start_threads (void)
82 // Each of this thread runs the event loop
83 this->activate (THR_NEW_LWP
| THR_JOINABLE
, this->nthreads_
, 1);
84 this->thr_mgr ()->wait ();
88 MT_AMH_Server::svc (void)