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 ()
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 ()
37 // Let the base server parse it's argumrents first
38 if (Base_Server::parse_args () != 1)
44 ACE_Get_Opt
get_opts (this->argc_
, this->argv_
, ACE_TEXT("n:"));
48 while ((c
= get_opts ()) != -1)
55 this->nthreads_
= ACE_OS::atoi (get_opts
.opt_arg ());
58 // Added unneeded '{ & }' just to satisfy Win32
59 for (int i
= count_argv
; i
<= this->argc_
; ++i
)
60 this->argv_
[i
] = this->argv_
[i
+2];
63 // Decrement the value of this->argc_ to reflect the removal
65 this->argc_
= this->argc_
- 2;
79 MT_AMH_Server::start_threads ()
81 // Each of this thread runs the event loop
82 this->activate (THR_NEW_LWP
| THR_JOINABLE
, this->nthreads_
, 1);
83 this->thr_mgr ()->wait ();