#include <cthread.hxx>
Inheritance diagram for control::cthread:

Public Types | |
| typedef sigc::signal< bool, cthread * >::iterator | notifyhandle |
Public Member Functions | |
| cthread () | |
| cthread (const std::string &nameid, const sigc::slot< bool > &exec_hook) | |
| virtual | ~cthread () |
| cthread::notifyhandle | notify_delegate (const sigc::slot< bool, cthread * > &_slot) |
| bool | release_delegate (const cthread::notifyhandle &_handle) |
| bool | run () |
| Initiates the start of the thread process by really creating the thread and then the hooked routine that runs in that thread. | |
| bool | exec_delegate (const sigc::slot< bool > &exec_hook) |
| This method is used to register (or connect) a startup method to the cthread::run_ signal later if the constructor used to instanciate this cthread class was not the one that takes a sigc::slot argument, or used to add another slot to the run_ signal. | |
| bool | notify () |
| bool | exit () |
| Simply terminates the thread by calling pthread_exit() - but before doing so, this method emits the cthread::end_ signal to perform the connected routines. | |
| bool | end_delegate (const sigc::slot< void > &end_hook) |
| const std::string & | name () const |
Protected Attributes | |
| std::string | _name |
Private Attributes | |
| sigc::signal< bool, cthread * > | notify_ |
| multi-purpose notificator signal. | |
| pthread_t | _pthID |
| PThread thread handle id. | |
| sigc::signal< bool > | run_ |
| sigc::signal< void > | end_ |
Friends | |
| void * | thread_start_entry (void *) |
Definition at line 37 of file cthread.hxx.
|
|
Definition at line 40 of file cthread.hxx. |
|
|
Definition at line 37 of file cthread.cc. 00037 : sigc::trackable()
00038 {
00039 }
|
|
||||||||||||
|
Definition at line 41 of file cthread.cc.
|
|
|
Definition at line 47 of file cthread.cc. References _pthID, end_, name(), notify_, and run_. 00048 {
00049 std::cerr << __PRETTY_FUNCTION__ << std::endl << '{' << std::endl << name() << std::endl;
00050 run_.clear();
00051 end_.clear();
00052 notify_.clear();
00053 pthread_cancel(_pthID);
00054 std::cerr << "thread exited ?" << std::endl;
00055 std::cerr << std::endl << '}' << std::endl;
00056 }
|
Here is the call graph for this function:

|
|
Definition at line 73 of file cthread.hxx. References end_. 00074 {
00075 end_.connect( end_hook );
00076 return true;
00077 }
|
|
|
This method is used to register (or connect) a startup method to the cthread::run_ signal later if the constructor used to instanciate this cthread class was not the one that takes a sigc::slot argument, or used to add another slot to the run_ signal.
Definition at line 83 of file cthread.cc. References run_. 00084 {
00085 run_.connect( exec_hook);
00086 return true;
00087 }
|
|
|
Simply terminates the thread by calling pthread_exit() - but before doing so, this method emits the cthread::end_ signal to perform the connected routines.
Definition at line 94 of file cthread.cc. 00095 {
00096 std::cerr << __PRETTY_FUNCTION__ << std::endl << '{' << std::endl << "." << std::endl;
00097 // signal the end of the thread just before aborting it!
00098 if(!end_.empty()) end_.emit();
00099 pthread_cancel(_pthID);
00100 std::cerr << std::endl << '}' << std::endl;
00101
00102 return true;
00103 }
|
|
|
Definition at line 81 of file cthread.hxx. References _name. Referenced by control::ccontrol::release(), control::ccontrol::start(), control::ccontrol::~ccontrol(), and ~cthread(). 00082 {
00083 return _name;
00084 }
|
|
|
Definition at line 64 of file cthread.hxx. References notify_. 00065 {
00066 return notify_.emit(this);
00067 }
|
|
|
Definition at line 48 of file cthread.hxx. References notify_. 00048 { return notify_.connect( _slot ); }
|
|
|
Definition at line 53 of file cthread.hxx. 00053 {
00054 if( _handle->empty() ) return false;
00055 _handle->disconnect();
00056 return true;
00057 }
|
|
|
Initiates the start of the thread process by really creating the thread and then the hooked routine that runs in that thread.
Definition at line 70 of file cthread.cc. References _pthID, and thread_start_entry. Referenced by control::ccontrol::start(). 00071 {
00072 int rc = pthread_create( &_pthID, 0l, thread_start_entry, (void*)this);
00073 if(rc) return false;
00074 return true;
00075 }
|
|
|
Real thread duties start here:
Definition at line 26 of file cthread.cc. Referenced by run(). 00027 {
00028 cthread* inst = (cthread*) thread_inst;
00030 inst->run_.emit();
00031 // -------------------------------
00033 return 0l;
00034 }
|
|
|
Definition at line 97 of file cthread.hxx. |
|
|
PThread thread handle id.
Definition at line 93 of file cthread.hxx. Referenced by exit(), run(), and ~cthread(). |
|
|
Definition at line 95 of file cthread.hxx. Referenced by end_delegate(), exit(), and ~cthread(). |
|
|
multi-purpose notificator signal.
Definition at line 91 of file cthread.hxx. Referenced by notify(), notify_delegate(), and ~cthread(). |
|
|
Definition at line 94 of file cthread.hxx. Referenced by cthread(), exec_delegate(), control::thread_start_entry(), and ~cthread(). |
1.4.0