#include <qapplication.h>
#include <qthread.h>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
//===========================================================
/*!
* SALOME_Event::SALOME_Event
* Constructor
*/
//===========================================================
-SALOME_Event::SALOME_Event( int salomeEventType, bool wait, bool autoRelease )
-: myType( salomeEventType ),
+SALOME_Event::SALOME_Event( int salomeEventType, bool wait, bool autoRelease ):
+ myType( salomeEventType ),
myWait( wait ),
myAutoRelease( autoRelease )
{
- MESSAGE( "SALOME_Event::SALOME_Event(): myType = "<<myType<<", myWait = "<<myWait );
- if ( wait ) {
+ if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this<<", myWait = "<<myWait );
+ if ( myWait ) {
// Prepare the semaphore
mySemaphore = new QSemaphore( 2 );
mySemaphore->operator+=( 2 );
//===========================================================
SALOME_Event::~SALOME_Event()
{
- MESSAGE( "SALOME_Event::~SALOME_Event(): myType = "<<myType<<", myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::~SALOME_Event(): this = "<<this<<", myWait = "<<myWait );
if ( myWait ) {
if ( mySemaphore->available() < mySemaphore->total() )
mySemaphore->operator-=( mySemaphore->total() - mySemaphore->available() );
//===========================================================
void SALOME_Event::process()
{
- MESSAGE( "SALOME_Event::process(): myType = "<<myType<<",myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<", myWait = "<<myWait );
QThread::postEvent( qApp, new QCustomEvent( SALOME_EVENT, (void*)this ) );
if ( myWait ) {
- MESSAGE( "SALOME_Event::process(): available = " << mySemaphore->available() );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::process(): available = " << mySemaphore->available() );
if ( !mySemaphore->available() )
mySemaphore->operator+=( 1 );
- MESSAGE( "SALOME_Event::process() COMPLETED: myType = "<<myType<<",myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::process() COMPLETED: this = "<<this<<", myWait = "<<myWait );
}
if ( myAutoRelease )
release();
//===========================================================
void SALOME_Event::processed()
{
- MESSAGE( "SALOME_Event::processed(): myType = "<<myType<<",myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this<<", myWait = "<<myWait );
if ( myWait ) {
- MESSAGE( "SALOME_Event::processed(): available = " << mySemaphore->available() );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): available = " << mySemaphore->available() );
if ( !mySemaphore->available() ) {
// process() takes control over mySemaphore after the next line is executed
mySemaphore->operator-=( 1 );
- MESSAGE( "SALOME_Event::processed(): semaphore DECREMENTED" );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): semaphore DECREMENTED" );
// Current thread will block here until process() completes
mySemaphore->operator+=( mySemaphore->total() );
}
}
- MESSAGE( "SALOME_Event::processed() COMPLETED: myType = "<<myType<<",myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::processed() COMPLETED: this = "<<this<<", myWait = "<<myWait );
}
//===========================================================
//===========================================================
void SALOME_Event::release()
{
- MESSAGE( "SALOME_Event::release(): myType = "<<myType<<",myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::release(): this = "<<this<<", myWait = "<<myWait );
if ( myWait ) {
- MESSAGE( "SALOME_Event::release(): available = " << mySemaphore->available() );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::release(): available = " << mySemaphore->available() );
mySemaphore->operator-=( mySemaphore->total() - mySemaphore->available() );
}
- MESSAGE( "SALOME_Event::release() COMPLETED: myType = "<<myType<<",myWait = "<<myWait );
+ if(MYDEBUG) MESSAGE( "SALOME_Event::release() COMPLETED: this = "<<this<<", myWait = "<<myWait );
}