threadimpl.h
来自「一个语言识别引擎」· C头文件 代码 · 共 63 行
H
63 行
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
#ifndef _ACECHECK_THREADIMPL_
#define _ACECHECK_THREADIMPL_
#include "Runnable.h"
#include "SemaphoreImpl.h"
#include <ace/Thread.h>
/**
* An abstraction for a thread of execution.
*/
class ThreadImpl : public Runnable {
public:
ThreadImpl();
ThreadImpl(Runnable *target);
virtual ~ThreadImpl();
int join(double seconds = -1);
virtual void run();
virtual void close();
// should throw if no success
virtual bool start();
bool isClosing();
bool isRunning() {
return active;
}
virtual void beforeStart();
virtual void afterStart(bool success);
// call before start
void setOptions(int stackSize = 0);
static int getCount();
// won't be public for long...
static void changeCount(int delta);
// get a unique key
long int getKey();
private:
int stackSize;
ACE_hthread_t hid;
ACE_thread_t id;
bool active;
bool closing;
Runnable *delegate;
static int threadCount;
static SemaphoreImpl threadMutex;
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?