thread.h

来自「tracciatore di mani con webcam」· C头文件 代码 · 共 50 行

H
50
字号
#ifndef __THREAD__INCLUDED_H_#define __THREAD__INCLUDED_H_#if defined(WIN32)#include <windows.h>#include <process.h>//#include <afxwin.h>//#include <afxmt.h>#else //WIN32#include <pthread.h>#endif //WIN32// ----------------------------------------------------------------------// class Thread// ----------------------------------------------------------------------class Thread { public:  Thread(void* (*fun)(void*), void* arg);  void Start();  void Stop();  void Join();  void Suspend(); // automatically releases all held locks  void Resume();  void Lock();  void Unlock(); protected:  ~Thread();  void*                 (*m_fun)(void*);  void*                   m_arg;#if defined(WIN32)  uintptr_t               m_thread;  HANDLE                  m_mutex;  //CWinThread*             m_pThread;  //CCriticalSection	    m_lock;#else //WIN32  pthread_t               m_threadID;  pthread_mutex_t         m_mutex;  pthread_cond_t          m_cond;#endif //WIN32};#endif // __THREAD__INCLUDED_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?