Considering the following class
class Foo
{
public:
void* func(void* arg)
{
// how to pass this function to pthread...?!
}
}
Later I want to pass func()
to pthread_create()
, instead of a function:
int main()
{
char * msg = "Hi dude";
Foo * ins = new Foo();
pthread_t pt;
// how to pass ins->func instead of a function?
pthread_create( &pt, NULL, ins->func, (void*)msg );
}
Thanks in advance.