3 #include "TestAppExceptionC.h"
6 OrbRunner::OrbRunner(CORBA::ORB_ptr orb
, unsigned num_orb_threads
)
7 : orb_(CORBA::ORB::_duplicate(orb
)),
8 num_orb_threads_(num_orb_threads
)
13 OrbRunner::~OrbRunner()
21 ACE_ASSERT(this->num_orb_threads_
> 0);
23 // If the num_orb_threads_ is exactly one, then just use the current
24 // (mainline) thread to run the ORB event loop.
25 if (this->num_orb_threads_
== 1)
27 // Since the num_orb_threads_ is exactly one, we just use the current
28 // (mainline) thread to run the ORB event loop.
33 // The num_orb_threads_ is greater than 1, so we will use an OrbTask
34 // (active object) to run the ORB event loop in (num_orb_threads_ - 1)
35 // threads. We use the current (mainline) thread as the other thread
36 // running the ORB event loop.
37 OrbTask
orb_task(this->orb_
.in(), this->num_orb_threads_
- 1);
39 // Activate the OrbTask worker threads
40 if (orb_task
.open(0) != 0)
43 "(%P|%t) Failed to open the OrbTask.\n"));
44 throw TestAppException();
47 // This will use the current (mainline) thread to run the ORB event loop.
50 // Now that the current thread has unblocked from running the orb,
51 // make sure to wait for all of the worker threads to complete.