Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / examples / CSD_Strategy / ThreadPool / OrbShutdownTask.cpp
blob1e8b594431356c03a22065af6ec12da015d4d398
1 // This may look like C, but it's really -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file OrbShutdownTask.cpp
7 * @author Tim Bradley <bradley_t@ociweb.com>
8 */
9 //=============================================================================
11 #include "OrbShutdownTask.h"
12 #include "ace/CORBA_macros.h"
13 #include "ace/OS_NS_unistd.h"
16 OrbShutdownTask::OrbShutdownTask()
21 OrbShutdownTask::~OrbShutdownTask()
26 void
27 OrbShutdownTask::orb(CORBA::ORB_ptr orb)
29 this->orb_ = CORBA::ORB::_duplicate (orb);
33 int
34 OrbShutdownTask::open(void*)
36 if (this->activate(THR_NEW_LWP | THR_JOINABLE, 1) != 0)
38 //FUZZ: disable check_for_lack_ACE_OS
39 // Assumes that when activate returns non-zero return code that
40 // no threads were activated.
41 ACE_ERROR_RETURN((LM_ERROR,
42 "(%P|%t) OrbShutdownTask failed to open().\n"),
43 -1);
44 //FUZZ: enable check_for_lack_ACE_OS
47 return 0;
51 int
52 OrbShutdownTask::svc()
54 ACE_OS::sleep (2);
55 ACE_DEBUG ((LM_DEBUG, "(%P|%t)OrbShutdownTask::svc shutdown orb\n"));
56 try
58 this->orb_->shutdown(0);
60 catch (...)
62 ACE_ERROR((LM_ERROR,
63 "(%P|%t) Exception raised by ORB::shutdown() call "
64 "in OrbShutdownTask::svc().\n"));
67 return 0;
71 int
72 OrbShutdownTask::close(u_long)
74 return 0;