singlethreadchecking.h

来自「遗传算法的一个库」· C头文件 代码 · 共 65 行

H
65
字号
#ifndef __GradSoft_ThreadService_SingleThreadChecking_h#define __GradSoft_ThreadService_SingleThreadChecking_h/* * part of GradSoft C++ ToolBox: Threading * (C) GradSoft 2001 * http://www.gradsoft.com.ua * $Id: SingleThreadChecking.h,v 1.5 2001/10/31 03:13:49 rssh Exp $ */#ifndef __GradSoft_ThreadService_h#include <GradSoft/ThreadService.h>#endif#ifndef __GradSoft_Thread_h#include <GradSoft/Thread.h>#endif#ifndef __GradSoft_ThreadEvent_h#include <GradSoft/ThreadEvent.h>#endifnamespace GradSoft {/** * Single thread service wich run in own thread and check * aviability of service before processing of runnable **/class SingleThreadChecking: public ThreadService, public Thread{private:  Runnable*   current_;  Mutex       currentMutex_;  ThreadEvent runnableArrived_;public:  SingleThreadChecking();  ~SingleThreadChecking();   /**   * process runnable, if worker thread is aviable, than   * process it immediatly, otherwise throw ResourceTemporaryNotAviable   * exception.   **/  void process(Runnable* runnable);  void  activate();    void  deactivate(bool shutdown);protected:  void run();};}#endif

⌨️ 快捷键说明

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