Subj : Re: warning : arg 3 of 'pthread_create' from incompatibe pointer type To : comp.programming.threads From : ptjm Date : Thu Mar 03 2005 03:22 am In article <1109787580.066987.310380@o13g2000cwo.googlegroups.com>, Jack wrote: % I am a beginner, 5 days-old pthread user. I was trying to write a % simple parallel sorting code. There are 3 nodes (2 leaves, 1 parent). 2 % leaves perform sequential quick sorting and parent node perform merge % sort from 2 child nodes. This doesn't describe your code. [...] % a1[i] = (int)rand(0) % MAX; rand() doesn't take an argument. rand_r() does, although it should not be 0. You should call srand() to seed the random number generator if you want to have different inputs each run. % quickSort( a1, 0, N-1); Here, you call quickSort from main()'s thread % thread_id = pthread_create(&thread1, NULL, a2_quick, &a2); % % pthread_join(thread1, NULL); and here you start a thread in the back-ground, then wait for it to finish without doing anything in the interim, so you might as well have just called a2_quick(&a2). I suggest moving the pthread_create call before the previous call to quickSort(), and leaving pthread_join() call where it is. % void a2_quick(int a2[]) The prototype of a thread function should be void *(*)(void *). You could have void * a2_quick(void * a2v) { int * a2 = a2v; ... -- Patrick TJ McPhee North York Canada ptjm@interlog.com .