|
#ifndef _WORKERTHREAD_H_
#define _WORKERTHREAD_H_
#include <Afxwin.h>
extern const UINT DO_WORK;
const int TIMEOUT_PER_THREAD = 200;
/**
*
* WorkerThread - This Thread class is created by WorkerThreadMgr
* This class will perform a work using WorkItem.
* Author : Ethihas M
* Date: 2005-08-28
*/
class WorkerThread : public CWinThread
{
DECLARE_DYNCREATE(WorkerThread)
public:
// Constructor
WorkerThread();
// Destructor
~WorkerThread();
// Initialize instance of thread
virtual BOOL InitInstance();
// Do a specific work
afx_msg LRESULT OnDoWork( WPARAM wParam_i, LPARAM lParam_i );
// Exit the worker thread
afx_msg LRESULT OnExitThread( WPARAM wParam_i, LPARAM lParam_i );
// Check Thread is idle or not
bool IsIdle();
// Terminate the worker thread
bool Terminate();
protected:
DECLARE_MESSAGE_MAP()
private:
// Sets the Status of the worker thread
void SetThreadIdleStatus( bool bStatus_i );
private:
// Holds the status of the worker thread
volatile bool m_bIdle;
// Critical section object for Synchronization
CRITICAL_SECTION m_CriticalSection;
};
#endif // _WORKERTHREAD_H_
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.