2,新增“Apps”; 3,新增“Common”; 4,新增“FileList”; 5,新增“MediaX”; 6,新增“OpenSource”; 7,新增“Samples”; 8,新增“SoftwareBusinessLines”.
37 lines
749 B
C++
37 lines
749 B
C++
#ifndef THREAD_H
|
|
#define THREAD_H
|
|
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
//typedef std::tr1::function<void()> ThreadFunc;
|
|
typedef void (*ThreadFunc) (void*);
|
|
class Thread
|
|
{
|
|
public:
|
|
explicit Thread(void* pthis,const ThreadFunc&, const std::string& name = std::string());
|
|
~Thread();
|
|
|
|
void start();
|
|
void join();
|
|
|
|
bool started() const { return started_; }
|
|
const std::string name() const { return name_; }
|
|
static int numCreated() { return numCreated_; }
|
|
|
|
private:
|
|
static unsigned int __stdcall startThread(void* thread);
|
|
void runInThread();
|
|
|
|
void* pThis_;
|
|
bool started_;
|
|
uintptr_t threadId_;
|
|
ThreadFunc func_;
|
|
std::string name_;
|
|
static volatile long numCreated_;
|
|
};
|
|
|
|
|
|
#endif // THREAD_H
|