Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / tests / Bug_2497_Regression_Test.cpp
blobb4f0e7a024e50525cc683bbae89af31dd5e9b87d
1 /**
2 * @file Bug_2497_Regression_Test.cpp
4 * Reproduces the problems reported in bug 2497
5 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2497
7 * @author sergant128@mail.ru
8 */
10 #include "test_config.h"
11 #include "ace/Module.h"
12 #include "ace/Task.h"
13 #include "ace/Stream.h"
15 class Test_Task : public ACE_Task<ACE_SYNCH>
17 public:
18 Test_Task( ) :
19 _destructorCalled(0)
23 ~Test_Task( ) override
25 ++_destructorCalled;
26 if (_destructorCalled > 1)
27 ACE_ERROR ((LM_ERROR,
28 ACE_TEXT ("Test_Task::~Test_Task() should be called once!!!\n")));
31 private:
32 int _destructorCalled;
36 class Test_Module : public ACE_Module<ACE_SYNCH>
38 public:
39 Test_Module( )
41 this->open( ACE_TEXT("Test module"),
42 &_writerTask,
43 &_readerTask,
45 M_DELETE_NONE );
48 private:
49 Test_Task _writerTask, _readerTask;
53 int
54 run_main (int, ACE_TCHAR *[])
56 ACE_START_TEST (ACE_TEXT ("Bug_2497_Regression_Test"));
58 ACE_Stream<ACE_SYNCH> stream;
60 if (stream.push(new Test_Module()) == -1)
62 ACE_ERROR ((LM_ERROR,
63 ACE_TEXT ("Error: push failed\n")));
66 ACE_END_TEST;
68 return 0;