Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.4 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT: Laserguard libraries
// SUBSYSTEM: LgLib
// FILE: Thread.h
// AUTHOR: Chizhevskiy Sergey
// OVERVIEW
// ~~~~~~~~
// Header file of CThread
//----------------------------------------------------------------------------
#ifndef __THREAD__H__INCLUDED__
#define __THREAD__H__INCLUDED__
#if _MSC_VER > 1000
#pragma once
#endif
class CLgThread
{
public:
CLgThread();
virtual ~CLgThread();
public:
virtual BOOL Start( BOOL bSelfDestroy );
virtual BOOL Stop( BOOL bWaitForComplete );
virtual BOOL IsStopping() { return m_hEventStopThread ? WaitForSingleObject( m_hEventStopThread, 0UL ) == WAIT_OBJECT_0 : FALSE; }
virtual BOOL IsStopped() { return m_hThread == NULL; }
public:
virtual DWORD GetThreadId() { return m_dwThreadId; }
virtual HANDLE GetThreadHandle() { return m_hThread; }
virtual HANDLE GetThreadStopEvent() { return m_hEventStopThread; }
protected:
virtual DWORD ThreadProc() = 0;
private:
enum { MAX_THREAD_CLOSE_TIME = 10000UL };
static UINT CALLBACK ThreadProc_( LPVOID );
private:
HANDLE m_hThread;
DWORD m_dwThreadId;
HANDLE m_hEventStopThread;
BOOL m_bSelfDestroy;
};
#endif