summaryrefslogtreecommitdiff
path: root/ACE/TAO/tests/Bug_2654_Regression/README
blob: dbda07fd6a9d7ed53f418436dbdafe5a3b156c26 (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
/**

@page Bug_2654_Regression README File

This test is for Bug 2654. Since bug 2654 is very difficult to
reproduce with an ordinary TAO build, hooks have been added to
tao/IIOP_Connector.cpp to enable slight delays durring the connection
process. See the bugzilla entry for more details. Enable the
INDUCE_BUG_2654_A flag and disable the fix (find "Fix for bug 2654")
in IIOP_Connector.cpp to see a pure virtual call. Otherwise the test
should always run to completion.

The essense of this test is the relationship between reference counted
ACE_Event_Handlers and the entities that refer to them. During the
development of the fix for bug 2654, the
ACE_Event_Handler::[add|remove]_reference methods were modified to
take the name of a calling function as a string and to print out the
current count as well as the identity of the caller. The following
code shows how this was done. Obviously all code that called add or
remove ref had to be modified to pass the caller name.

ACE_Event_Handler::Reference_Count
ACE_Event_Handler::add_reference (const char * caller)
{
  int reference_counting_required =
    this->reference_counting_policy ().value () ==
    ACE_Event_Handler::Reference_Counting_Policy::ENABLED;

  if (reference_counting_required)
    {
      Reference_Count result =
        ++this->reference_count_;
      ACE_DEBUG ((LM_DEBUG,"(%P|%t)EH[0x%x]::add_ref called by %s, now %d\n",
                  this,caller, result));
      return result;
    }
  else
    return 1;
}

ACE_Event_Handler::Reference_Count
ACE_Event_Handler::remove_reference (const char * caller)
{
  int reference_counting_required =
    this->reference_counting_policy ().value () ==
    ACE_Event_Handler::Reference_Counting_Policy::ENABLED;

  if (reference_counting_required)
    {
      Reference_Count result =
        --this->reference_count_;
      ACE_DEBUG ((LM_DEBUG,
                  "(%P|%t)EH[0x%x]::remove_ref called by %s, now %d\n",
                  this, caller, result));

      if (result == 0)
        delete this;

      return result;
    }
  else
    {
      return 1;
    }
}

To run the test use the run_test.pl script:

$ ./run_test.pl

	the script returns 0 if the test was successful.

*/