summaryrefslogtreecommitdiff
path: root/TAO/tests/CSD_Strategy_Tests/TP_Common/OrbShutdownTask.cpp
blob: e0932bd4c383b9acfa56b0973a4075147b2b1db9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// This may look like C, but it's really -*- C++ -*-

//=============================================================================
/**
 *  @file    OrbShutdownTask.cpp
 *
 *  @author  Tim Bradley <bradley_t@ociweb.com>
 */
//=============================================================================

#include "OrbShutdownTask.h"
#include "ace/CORBA_macros.h"
#include "ace/OS_NS_unistd.h"


OrbShutdownTask::OrbShutdownTask()
{
}


OrbShutdownTask::~OrbShutdownTask()
{
}


void
OrbShutdownTask::orb(CORBA::ORB_ptr orb)
{
  this->orb_ = CORBA::ORB::_duplicate(orb);
}


int
OrbShutdownTask::open(void*)
{
  if (this->activate(THR_NEW_LWP | THR_JOINABLE, 1) != 0)
    {
      //FUZZ: disable check_for_lack_ACE_OS
      // Assumes that when activate returns non-zero return code that
      // no threads were activated.
      ACE_ERROR_RETURN((LM_ERROR,
                        "(%P|%t) OrbShutdownTask failed to open().\n"),
                       -1);
      //FUZZ: enable check_for_lack_ACE_OS
    }

  return 0;
}


int
OrbShutdownTask::svc()
{
  try
  {
    this->orb_->shutdown(0);
  }
  catch (...)
  {
    ACE_ERROR((LM_ERROR,
      "(%P|%t) Exception raised by ORB::shutdown() call "
      "in OrbShutdownTask::svc().\n"));
  }

  return 0;
}


int
OrbShutdownTask::close(u_long)
{
  return 0;
}