Subj : Re: How to pass class-member function to pthread_create(....)? To : comp.programming.threads From : Joe Seigh Date : Fri Jul 15 2005 08:37 am Huskier@gmail.com wrote: > Hi all: > > I want to pass a class-member function to pthread_create, and my > code is in the following, but I don't know how to pass > myobj.thread_function to pthread_create function. > > class test > { > public: > test(){} > ~test(){} > void thread_function(void*){} > }; > .... > > > > pthread_create(...)'s Syntax > > #include ; > > int pthread_create (pthread_t *thread, const pthread_attr_t *attr, void > *(*start_routine) (void *), void *arg) ; > You'll have to use a static function (with external "C" I believe) that is used as the function parameter for pthread_create. I will have to invoke the method. The object and other parameterw will have to be passed by arg. If just object, a simple cast will do, otherwise they have to be passed in a structure. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .