Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / tests / Dynamic_TP / ORB_ThreadPool / Test_i.cpp
blob7c509f094ea9394ff9f114c8b64f2b395ab81549
1 #include "Test_i.h"
2 #include "ace/OS_NS_unistd.h"
4 Sleeper_i::Sleeper_i (CORBA::ORB_ptr orb)
5 : orb_ (CORBA::ORB::_duplicate (orb))
9 void
10 Sleeper_i::delay(CORBA::Short sec)
12 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Sleeper_i::delay called\n")));
13 ACE_OS::sleep (sec);
14 ACE_DEBUG ((LM_DEBUG,
15 ACE_TEXT ("(%P|%t) Sleeper_i::delay returning\n")));
18 void
19 Sleeper_i::shutdown ()
21 this->orb_->shutdown (false);
24 //-----------------------------------------------
26 Middle_i::Middle_i (CORBA::ORB_ptr orb, Test::Sleeper_ptr s)
27 : orb_ (CORBA::ORB::_duplicate (orb)),
28 sleeper_ (Test::Sleeper::_duplicate (s))
32 void
33 Middle_i::call_delay(CORBA::Short sec)
35 ACE_DEBUG ((LM_DEBUG,
36 ACE_TEXT ("(%P|%t) Middle_i::delay called\n")));
38 ACE_hthread_t thr;
39 ACE_Thread::self (thr);
40 bool recursive = false;
42 ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_);
43 int result = this->threads_.insert (thr);
44 ACE_ASSERT (result != -1);
45 if (result == 1)
47 ACE_DEBUG ((LM_DEBUG,
48 ACE_TEXT ("(%P|%t) Middle_i::call_delay, ")
49 ACE_TEXT ("recursive upcall detected for thr = %d\n"),
50 thr));
51 recursive = true;
55 this->sleeper_->delay(sec);
57 if (!recursive)
59 ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_);
60 int result = this->threads_.remove (thr);
61 if (result == -1)
62 ACE_DEBUG ((LM_DEBUG,
63 ACE_TEXT ("(%P|%t) Middle_i::call_delay, ")
64 ACE_TEXT ("unable to remove thr = %d\n"),
65 thr));
66 ACE_ASSERT (result != -1);
69 ACE_DEBUG ((LM_DEBUG,
70 ACE_TEXT("(%P|%t) Middle_i::delay returning recursive = %d\n"),
71 recursive));
74 void
75 Middle_i::shutdown ()
77 sleeper_->shutdown ();
78 this->orb_->shutdown (false);