Multiple argument in pthread_create
c, linux, pthreads
Solution
With your `void*` you can pass a struct of your choosing:
struct my_args {
int arg1;
double arg2;
};
This effectively allows you to pass arbitrary arguments in. Your thread start routine can do nothing other than un-pack those to call the real thread start routine (which could in itself come from that struct).
Problem
According to pthread_create man page, the argument of the function is: ``` int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); ``` regarding the void `*arg`, I just wonder if I can pass multiple argument to it, because the function that I write requires 2 arguments.