Subj : Re: pthread and C++ To : comp.programming.threads From : Ian Date : Sat Aug 20 2005 09:44 am ChasW wrote: > Im sorry if this has been answered recently and I failed to see the > posting. > > Is it not possible to access C++ object public members from pthreads? > > Im doing the following and getting exceptions: > > Using a global pointer to a dynamically allocated C++ object, i am > passing the pointer to pthread_create. > > Within the body of the thread function, I cast the argument to my > class type like this: > > void* threadServiceInput( void* arg ) > { > // cast arg to my object pointer > myClassT* ptr = reinterpret_cast( arg ); > > But anything i access via ptr-> pops an exception. > Should be OK, assuming the object is still there, post your pthread_create, maybe you are passing in the wrong parameters. Ian .