summaryrefslogtreecommitdiff
path: root/trunk/TAO/tests/Bug_1551_Regression/Hello.cpp
blob: 5c72639015fafb1940e2c6e59634fec30b7b0423 (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
// $Id$

#include "Hello.h"
#include "ace/OS_NS_unistd.h"

ACE_RCSID(Bug_1XXX_Regression, Hello, "$Id$")

Hello::Hello(
    CORBA::ORB_ptr orb,
    bool simulate_crashes)
  : orb_ (CORBA::ORB::_duplicate (orb))
  , simulate_crashes_(simulate_crashes)
  , atomic_counter_(200)
{
}

void
Hello::short_sleep (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  long count = atomic_counter_--;

#if 0
  if(count % 40 == 0)
  {
    ACE_DEBUG((LM_DEBUG, "(%P|%t) Counter was %d\n", count));
  }
#endif /* 0 */
  if(simulate_crashes_ && count == 0)
  {
    ACE_DEBUG((LM_DEBUG, "Aborting!\n"));
    ACE_Time_Value tv(5, 0);
    ACE_OS::sleep(tv);
    ACE_OS::abort();
  }
}