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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
/*
* Modification History
*
* 2002-March-9 Jason Rohrer
* Created.
*
* 2002-March-10 Jason Rohrer
* Made destructor public.
*
* 2002-March-11 Jason Rohrer
* Changed so that destructor joins thread.
*
* 2002-April-4 Jason Rohrer
* Changed name of lock to avoid confusion with subclass-provided locks.
*
* 2004-April-1 Jason Rohrer
* Moved from konspire2b into minorGems.
* Changed so that destructor does not join the thread.
*
* 2004-November-19 Jason Rohrer
* Changed to virtual inheritance from Thread class.
*/
#ifndef FINISHED_SIGNAL_THREAD_INCLUDED
#define FINISHED_SIGNAL_THREAD_INCLUDED
#include "minorGems/system/Thread.h"
#include "minorGems/system/MutexLock.h"
/**
* Abstract subclass if thread that has a
* synchronized finished signal.
*
* @author Jason Rohrer
*/
class FinishedSignalThread : public virtual Thread {
public:
/**
* Only destroys this thread.
* Does not join.
*/
virtual ~FinishedSignalThread();
/**
* Gets whether this thread is finished and
* ready to be destroyed.
*
* @return true iff this thread is finished.
*/
char isFinished();
protected:
FinishedSignalThread();
/**
* Sets that this thread is finished and
* ready to be destroyed.
*
* For this class to work properly, the subclass
* MUST call this function at the end of its run method.
*/
void setFinished();
private:
MutexLock *mFinishedLock;
char mFinished;
};
#endif
|