In c, we create a stream like this:
void * run(void * arg){
printf("hello world\n");
}
int main(){
pthread_t thread;
int a = pthread_create(&thread, NULL, run, (void*)0);
}
But this will not work if I declare the launch as
void run(){}
On the other hand, if I pass it in (void *)in the parameter pthread_create, it works fine. Therefore, it accepts only functions with return types (void *).
Why?
Thank!
source
share