summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_1020_Basic_Regression/Echo.cpp
blob: 05cf417b3a06f6997efde747f0dd1cf40fddc973 (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
#include "Echo.h"
#include "ace/OS_NS_unistd.h"

ACE_RCSID(Bug_1269_Regression, Echo, "$Id$")

Echo::Echo(CORBA::ORB_ptr orb,
           int abort_counter)
  : orb_(CORBA::ORB::_duplicate(orb))
    , abort_counter_ (abort_counter),
    mutex_ ()
{
}

void
Echo::echo_payload (Test::Payload &)
{
  ACE_MT (ACE_GUARD (TAO_SYNCH_MUTEX,
                     ace_mon,
                     this->mutex_));

  this->abort_counter_--;

  if (this->abort_counter_ == 0)
    {
      ACE_DEBUG ((LM_DEBUG, "(%P|%t) Echo::echo_payload, sleeping\n"));

      // Sleep for 10 seconds, forcing a flow control of some kind.
      ACE_OS::sleep (5);

      // Run the ORB for a while, to generate a short-lived release of
      // the flow control.
      /*ACE_Time_Value tv (0, 10000);
      this->orb_->run (tv);*/

      ACE_DEBUG ((LM_DEBUG,
                  "(%P|%t) Echo::echo_payload, aborting\n"));

      // Kill the app
      ACE_OS::abort();
    }
}