Subj : Re: creating a pthread To : comp.programming.threads From : Eric Sosman Date : Thu Mar 17 2005 03:56 pm JS wrote: > I have an incomplete pthread_create function that looks like this: > > pthread_create(pthread * thread, pthread_attr_t *attr, void * > (*start_routine)(void *), void *arg){ > > } > > The third parameter is where my new thread will start to execute: > > void * start_routine(void *param){ > > } > > > my questions is: > > Will the fourth parameter (void * arg) be the parameter send to the > start_routine function?? Are you trying to use the pthread_create() function your POSIX system provides, or are you trying to implement your own version of pthread_create() for a system that lacks one? Either way, if the function conforms to the POSIX description the fourth argument to pthread_create() is passed to the target function as its single argument. If you're writing a function to compute Fibonacci numbers or search your hard disk for bad blocks, the arguments have whatever significance you attach to them -- but *please* don't call the function pthread_create()! -- Eric.Sosman@sun.com .