CTimeoutAssertionThread Class Reference

#include <timeout_assertion_thread.h>

Inheritance diagram for CTimeoutAssertionThread:

NLMISC::IRunnable

Public Types

enum  TControl { ACTIVE, INACTIVE, QUIT }

Public Member Functions

void activate ()
 CTimeoutAssertionThread (uint32 timeout=0)
void desactivate ()
virtual void getName (std::string &result) const
void quit ()
void run ()
void timeout (uint32 to)

Private Attributes

volatile TControl _Control
volatile uint32 _Counter
volatile uint32 _Timeout

Member Enumeration Documentation

enum CTimeoutAssertionThread::TControl
 

Enumeration values:
ACTIVE 
INACTIVE 
QUIT 

Definition at line 56 of file timeout_assertion_thread.h.

00056 { ACTIVE, INACTIVE, QUIT };


Constructor & Destructor Documentation

CTimeoutAssertionThread::CTimeoutAssertionThread uint32  timeout = 0  )  [inline]
 

Definition at line 58 of file timeout_assertion_thread.h.

References _Control, _Counter, INACTIVE, and uint32.

00058                                                     : _Control(INACTIVE), _Counter(0), _Timeout(timeout)
00059         {
00060         }


Member Function Documentation

void CTimeoutAssertionThread::activate void   )  [inline]
 

Definition at line 86 of file timeout_assertion_thread.h.

References _Control, _Counter, ACTIVE, INACTIVE, nlassert, and QUIT.

Referenced by NLNET::IService::main().

00087         {
00088                 if(_Control == QUIT) return;
00089                 nlassert(_Control == INACTIVE);
00090                 _Counter++;
00091                 _Control = ACTIVE;
00092                 //nldebug("activate");
00093         }

void CTimeoutAssertionThread::desactivate  )  [inline]
 

Definition at line 95 of file timeout_assertion_thread.h.

References _Control, ACTIVE, INACTIVE, nlassert, and QUIT.

Referenced by NLNET::IService::main().

00096         {
00097                 if(_Control == QUIT) return;
00098                 nlassert(_Control == ACTIVE);
00099                 _Control = INACTIVE;
00100                 //nldebug("desactivate");
00101         }

virtual void NLMISC::IRunnable::getName std::string &  result  )  const [inline, virtual, inherited]
 

Reimplemented in NL3D::CAsyncFileManager3D::CMeshLoad, NL3D::CAsyncFileManager3D::CIGLoad, NL3D::CAsyncFileManager3D::CIGLoadUser, NL3D::CAsyncFileManager3D::CTextureLoad, NL3D::CZoneLoadingTask, NLPACS::CGlobalRetriever::CLrLoader, NLMISC::CAsyncFileManager::CFileLoad, NLMISC::CAsyncFileManager::CMultipleFileLoad, and NLMISC::CAsyncFileManager::CSignal.

Definition at line 74 of file thread.h.

Referenced by NLMISC::CTaskManager::run().

00075         {
00076                 result = "NoName";
00077         }

void CTimeoutAssertionThread::quit  )  [inline]
 

Definition at line 103 of file timeout_assertion_thread.h.

References _Control, nlassert, and QUIT.

00104         {
00105                 nlassert(_Control != QUIT);
00106                 _Control = QUIT;
00107                 //nldebug("quit");
00108         }

void CTimeoutAssertionThread::run void   )  [inline, virtual]
 

Implements NLMISC::IRunnable.

Definition at line 62 of file timeout_assertion_thread.h.

References _Control, _Counter, ACTIVE, nlassert, NLMISC::nlSleep(), QUIT, and uint32.

00063         {
00064                 uint32 lastCounter;
00065                 while(_Control != QUIT)
00066                 {
00067                         if(_Control != ACTIVE || _Timeout == 0)
00068                         {
00069                                 //nldebug("not active, sleep");
00070                                 NLMISC::nlSleep(1000);
00071                         }
00072                         else
00073                         {
00074                                 //nldebug("active, enter sleep");
00075                                 lastCounter = _Counter;
00076                                 NLMISC::nlSleep(_Timeout);
00077                                 //nldebug("active, leave sleep, test assert");
00078 
00079                                 // If this assert occured, it means that a checked part of the code was
00080                                 // to slow and then I decided to assert to display the problem.
00081                                 nlassert(!(_Control==ACTIVE && _Counter==lastCounter));
00082                         }
00083                 }
00084         }

void CTimeoutAssertionThread::timeout uint32  to  )  [inline]
 

Definition at line 110 of file timeout_assertion_thread.h.

References uint32.

Referenced by NLNET::UpdateAssertionThreadTimeoutCB().

00111         {
00112                 _Timeout = to;
00113                 //nldebug("change timeout to %d", to);
00114         }


Field Documentation

volatile TControl CTimeoutAssertionThread::_Control [private]
 

Definition at line 117 of file timeout_assertion_thread.h.

Referenced by activate(), CTimeoutAssertionThread(), desactivate(), quit(), and run().

volatile uint32 CTimeoutAssertionThread::_Counter [private]
 

Definition at line 118 of file timeout_assertion_thread.h.

Referenced by activate(), CTimeoutAssertionThread(), and run().

volatile uint32 CTimeoutAssertionThread::_Timeout [private]
 

Definition at line 119 of file timeout_assertion_thread.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 06:43:53 2004 for NeL by doxygen 1.3.6