task.h

00001 #ifndef _DHT_KADC_TASK_H_
00002 #define _DHT_KADC_TASK_H_
00003 
00004 #include <ace/Condition_T.h>
00005 #include <ace/Recursive_Thread_Mutex.h>
00006 #include <ace/Task.h>
00007 
00008 namespace dht {
00009 namespace kadc {
00010     using namespace std;
00011     
00012     class task : public ACE_Task_Base {
00013         volatile bool _quit;
00014         ACE_Thread_Mutex _m;
00015         typedef ACE_Condition<ACE_Thread_Mutex> cond_type;
00016         cond_type *_cond;
00017         const char *_id;
00018     public:
00019         task(const char *id = "");
00020         virtual ~task();
00021         
00022         inline int acquire() { return _m.acquire(); }
00023         inline int release() { return _m.release(); }
00024         int wait(const ACE_Time_Value &timeout);
00025         void quit(bool val);
00026         bool quit();
00027         
00028         inline int join() { return ACE_Task_Base::wait(); }
00029         inline const char *id() { return _id; }
00030     };
00031     
00032 } // ns kadc
00033 } // ns dht
00034 
00035 #endif //_DHT_KADC_TASK_H_

Generated on Thu Mar 1 16:18:47 2007 for libdht by  doxygen 1.5.1