ReplicaNet and RNLobby  1
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
ThreadClass Class Referenceabstract

#include <ThreadClass.h>

Inheritance diagram for ThreadClass:
Inheritance graph
[legend]
Collaboration diagram for ThreadClass:
Collaboration graph
[legend]

Public Member Functions

 ThreadClass ()
 
virtual ~ThreadClass ()
 
void Sleep (int milliseconds)
 
- Public Member Functions inherited from MutexClass
 MutexClass ()
 
virtual ~MutexClass ()
 
void Lock (void)
 
void UnLock (void)
 

Protected Member Functions

void DoQuitNow (const int returnCode)
 
virtual int ThreadEntry (void)=0
 
virtual void ThreadExiting (const int returnCode)
 
void CheckQuit (void)
 

Static Protected Member Functions

static size_t GetNumAllocated (void)
 

Friends

class Thread
 

Additional Inherited Members

- Public Types inherited from MutexClass
enum  { kNoOwnerThread = -1 }
 

Detailed Description

This is a class that the thread manager can thread with. Entry for a thread starts at ThreadEntry.

Constructor & Destructor Documentation

The ctor performs some basic initialisation

virtual ~ThreadClass ( )
virtual

The dtor makes sure everything is tidy

Member Function Documentation

void CheckQuit ( void  )
protected

If Thread::Terminate() has been called then using this function will exit the thread.

void DoQuitNow ( const int  returnCode)
protected

This exits the thread and can only be used in the context of the thread.

Parameters
returnCodeThe return code.
void Sleep ( int  milliseconds)

Sleeps the thread for the class by the number of milliseconds supplied. This uses the CurrentThreadSleep() function. Internally this is a point where the thread can be cancelled by Thread::Terminate(). The thread must not have any mutex object with a current lock when Sleep() is called otherwise a deadlock situation may develop. Memory should not be allocated on the heap at this point unless it can be freed by ThreadExiting() or the class dtor.

Parameters
millisecondsthe sleep time in milliseconds
virtual int ThreadEntry ( void  )
protectedpure virtual

The thread starts executing from here.

Implemented in AdvertiseClient::PingServer, BaseTransportServer, ASyncUpdateCheck, Worker, BaseServer, and Security.

virtual void ThreadExiting ( const int  returnCode)
protectedvirtual

This is called just before the thread exits, from the context of the thread.

Reimplemented in Worker.