views:

63

answers:

1

Can threads have more than one argument without using a struct?

So... kind of like:

pthread_create(&file_thread, NULL, merge_thread, sortedFiles, number); 

... where 'number' is the extra argument?

Thanks, Hristo

+3  A: 

No. You'll have to define a struct to contain the various parameters, and pass a pointer to an instance of the struct as the single void* argument to pthread_create.

Andrew Medico
I was hoping there would be another way. Thanks.
Hristo
Hristo: The judicious use of a wrapper function can hide the use of the structure for you.
Clifford