home *** CD-ROM | disk | FTP | other *** search
- // =================================================================
- // Thread.h
- // =================================================================
- // Harold Kasperink / John Dekker
- // Dr. Dobb's Journal 1997
- // =================================================================
- // Thread class
- // =================================================================
- #ifndef _THREAD_H_
- #define _THREAD_H_
-
- // Fake thread library
- typedef int pthread_t;
-
- #ifdef _WIN32
- #include <afxwin.h>
- #include <winbase.h>
- #endif
-
- #ifndef boolean
- #define boolean BOOL
- #endif
- #define FALSE 0
- #define TRUE 1
-
- class CThread;
- void ThreadFunc(CThread *);
-
- ////////////////////////////////////////////////////////////////////
- // CNutex
- ////////////////////////////////////////////////////////////////////
- class CThread
- {
- public:
- CThread();
- virtual ~CThread();
-
- void Create();
- void Cancel();
- void Detach();
- void Join();
-
- friend void ThreadFunc(CThread *);
- virtual void Process(void) = 0;
- private:
- pthread_t m_Thread;
- };
-
- #endif
-