public:
typedef int (*func_t)(int);
typedef int (*callback_t)(int);
- typedef void* handle_t;
+ //typedef void* handle_t;
+ typedef typename _Impl::handle_type handle_t;
protected:
_Impl m_impl;
thread_handle_t m_handle;
+
+ // Assert
+ void handle_assert(const char* method_name){
+ if ( m_handle == _Impl::invalid_handle )
+ throw io_exception(::std::string(method_name) + "(): Handler is Invalid.");
+ }
+
public:
thread_(){
m_handle = NULL;
template <typename _Func, typename _Param>
thread_(_Func func, _Param param=0, void* opt=NULL)
{
+ m_handle = NULL;
if ( start(func,param,opt) != true )
thread_exception("thread start failed.");
}
template <typename _Class, typename _Param, typename _Ret>
thread_(_Class* p_this, _Ret (_Class::*func)(_Param), _Param param=0, void* opt=NULL)
{
+ m_handle = NULL;
if ( start_class_ptr(p_this,func,param,opt) != true )
thread_exception("thread start failed.");
}
}*/
template <typename _Class, typename _Param, typename _Ret>
- bool start(_Ret (__thiscall _Class::*func)(_Param), _Param param=0, void* opt=NULL)
+ bool start(_Ret (_Class::*func)(_Param), _Param param=0, void* opt=NULL)
{
// The second parameter is a class pointer or the method should be static.
The_second_parameter_is_a_class_pointer_or_the_method_should_be_static.
////////////////////////////////////////////////////
- bool release()
+ /*bool release()
{
if ( m_handle != NULL )
return m_impl.release(m_handle);
return true;
+ }*/
+ void release()
+ {
+ if ( m_handle != NULL )
+ m_impl.release(m_handle);
}
bool join(unsigned int timeout_ms=-1)
{
return false;
return m_impl.join(m_handle, timeout_ms);
}
- bool is_alive()
+ bool is_alive() const
{
if ( m_handle == NULL )
return false;