Zero  0.1.0
Public Member Functions | Private Attributes | List of all members
member_func_thread_t< Class, Functor > Class Template Reference

wraps up a class instance and a member function to look like a thread_t. Use the convenience function below to instantiate. More...

#include <kits_thread.h>

Inheritance diagram for member_func_thread_t< Class, Functor >:
thread_t thread_wrapper_t

Public Member Functions

 member_func_thread_t (Class *instance, Functor func, const std::string &thread_name)
 
virtual void work ()
 
- Public Member Functions inherited from thread_t
bool delete_me ()
 
std::string thread_name ()
 
randgen_trandgen ()
 Returns pointer to thread_t's randgen_t object. More...
 
int rand ()
 Returns a pseudo-random integer between 0 and RAND_MAX. More...
 
int rand (int n)
 
virtual ~thread_t ()
 
- Public Member Functions inherited from thread_wrapper_t
 thread_wrapper_t ()
 
virtual ~thread_wrapper_t ()
 
virtual void before_run ()
 
virtual void after_run ()
 
void spawn ()
 
void fork ()
 
void join ()
 

Private Attributes

Class * _instance
 
Functor _func
 

Additional Inherited Members

- Protected Member Functions inherited from thread_t
 thread_t (const std::string &name)
 
- Protected Attributes inherited from thread_t
bool _delete_me
 

Detailed Description

template<class Class, class Functor>
class member_func_thread_t< Class, Functor >

wraps up a class instance and a member function to look like a thread_t. Use the convenience function below to instantiate.

Constructor & Destructor Documentation

§ member_func_thread_t()

template<class Class, class Functor>
member_func_thread_t< Class, Functor >::member_func_thread_t ( Class *  instance,
Functor  func,
const std::string &  thread_name 
)
inline

Member Function Documentation

§ work()

template<class Class, class Functor>
virtual void member_func_thread_t< Class, Functor >::work ( )
inlinevirtual

The previously used run() is already used by smthread core. Thus, run() now does the thread_t specific setup and calls work(). That is, work() is the new entry function for thread_t instead of run().

Implements thread_t.

Member Data Documentation

§ _func

template<class Class, class Functor>
Functor member_func_thread_t< Class, Functor >::_func
private

§ _instance

template<class Class, class Functor>
Class* member_func_thread_t< Class, Functor >::_instance
private

The documentation for this class was generated from the following file: