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
|
/**
* @file Bug_2497_Regression_Test.cpp
*
* $Id: Bug_2497_Regression_Test.cpp 91673 2010-09-08 18:49:47Z johnnyw $
*
* Reproduces the problems reported in bug 2497
* http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=2497
*
* @author sergant128@mail.ru
*/
#include "test_config.h"
#include "ace/Module.h"
#include "ace/Task.h"
#include "ace/Stream.h"
class Test_Task : public ACE_Task<ACE_SYNCH>
{
public:
Test_Task( void ) :
_destructorCalled(0)
{
}
virtual ~Test_Task( void )
{
++_destructorCalled;
if (_destructorCalled > 1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Test_Task::~Test_Task() should be called once!!!\n")));
}
private:
int _destructorCalled;
};
class Test_Module : public ACE_Module<ACE_SYNCH>
{
public:
Test_Module( void )
{
this->open( ACE_TEXT("Test module"),
&_writerTask,
&_readerTask,
0,
M_DELETE_NONE );
}
private:
Test_Task _writerTask, _readerTask;
};
int
run_main (int, ACE_TCHAR *[])
{
ACE_START_TEST (ACE_TEXT ("Bug_2497_Regression_Test"));
ACE_Stream<ACE_SYNCH> stream;
if (stream.push(new Test_Module()) == -1)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Error: push failed\n")));
}
ACE_END_TEST;
return 0;
}
|