cthread.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FELIXCTHREAD_HXX
00022 #define FELIXCTHREAD_HXX
00023
00024 #include <sigc++/sigc++.h>
00025 #include <pthread.h>
00026 #include <string>
00027
00028 namespace control {
00029
00037 class cthread : public sigc::trackable
00038 {
00039 public:
00040 typedef sigc::signal<bool, cthread*>::iterator notifyhandle;
00041 cthread();
00042 cthread(const std::string& nameid, const sigc::slot<bool>& exec_hook);
00043 virtual ~cthread();
00044
00048 cthread::notifyhandle notify_delegate( const sigc::slot<bool, cthread*>& _slot ) { return notify_.connect( _slot ); }
00053 bool release_delegate( const cthread::notifyhandle& _handle) {
00054 if( _handle->empty() ) return false;
00055 _handle->disconnect();
00056 return true;
00057 }
00058 bool run();
00059 bool exec_delegate( const sigc::slot<bool>& exec_hook);
00060
00064 bool notify()
00065 {
00066 return notify_.emit(this);
00067 }
00068 bool exit();
00069
00073 bool end_delegate( const sigc::slot<void>& end_hook )
00074 {
00075 end_.connect( end_hook );
00076 return true;
00077 }
00081 const std::string& name() const
00082 {
00083 return _name;
00084 }
00085
00086 private:
00087 friend void *thread_start_entry(void*);
00088
00089
00091 sigc::signal<bool, cthread*> notify_;
00093 pthread_t _pthID;
00094 sigc::signal<bool> run_;
00095 sigc::signal<void> end_;
00096 protected:
00097 std::string _name;
00098 };
00099
00100 }
00101
00102 #endif
00103
00104
API Documentation Generated by:
1.4.0
About the author |

Site started with trial version of DreamWeaver MX 2004 |
Finalizing with

|
Contact | ©2005, Serge Lussier ( Bretzel )