Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Bug_2654_Regression / Hello.cpp
bloba60a9b3d8fd88854a52202dcbb8a7c4c8aafb0bc
1 #include "Hello.h"
2 #include "ace/Task.h"
4 ACE_THR_FUNC_RETURN killer (void *arg)
6 CORBA::ORB_var orb = reinterpret_cast<CORBA::ORB_ptr> (arg);
8 ACE_DEBUG ((LM_DEBUG,"(%P|%t) server exiting\n"));
9 orb->shutdown (1);
11 return 0;
14 Hello::Hello (CORBA::ORB_ptr orb)
15 : orb_ (CORBA::ORB::_duplicate (orb)),
16 count_(0)
21 void
22 Hello::set_callback (Test::CallBack_ptr cb)
24 ACE_DEBUG ((LM_DEBUG,"(%P|%t) got callback\n"));
25 this->callback_ = Test::CallBack::_duplicate(cb);
26 this->callback_->method2();
29 void
30 Hello::method (CORBA::Short count)
32 if (++this->count_ > 10)
34 ACE_DEBUG ((LM_DEBUG, "(%P|%t) supplied count = %d\n", count));
35 PortableServer::POA_var poa = this->_default_POA();
36 PortableServer::POAManager_var mgr = poa->the_POAManager();
37 mgr->hold_requests(false);
38 // Pass duplicated ptr to a thread and let the thread to free the reference.
39 CORBA::ORB_ptr orb = CORBA::ORB::_duplicate (this->orb_.in ());
40 ACE_Thread_Manager::instance()->spawn_n (1,
41 ACE_THR_FUNC (killer),
42 static_cast<void*> (orb));