You can't use a regular member function as a thread function because it has
an implied "this" pointer.
Why not pass "this" as the parameter to the static membe function in the
thread, and then invoke the non-static from the thread?
i.e.
class foo {
//...
static void *ThreadFunc(void *)
void *MemberFunc(void *);
Quote:}
void *foo::ThreadFunc(void *p)
{
foo* pObj = static_cast<foo*>(p);
return pObj->MemberFunc(some_parameter_here);
}
Quote:> I am able to thread a static member function... but was wondering if
anyone
> knew if I could thread a normal member function.
> class A {
> void *function( void * );
> void *function2( void * );
> };
> void *A::function( void *args )
> { ...... }
> void *A::function2( void *args )
> {
> pthread_t tid;
> pthread ( %tid, NULL, ????, NULL );
> }