I know the thread routine that is passed to pthread_create API has the prototype of
void *threadproc(void *).
I was just wondering if it i
A pthread function must have C linkage, so it cannot be a member function. Strictly speaking, it cannot even be a static member function, even though that will work almost all the time.
So what should be done is to create a non-member function that takes a void*
argument that will be a pointer to the C++ object to be the thread function. That function can cast the void*
argument to a class pointer, which calls the member function.
See In C++, is it safe/portable to use static member function pointer for C API callbacks?