Incinerator
Limp Gawd
- Joined
- Aug 31, 2005
- Messages
- 252
ok, I'm trying to use pthreads to sort an array quickly and I'm using odd-even transposition sort so I can use multiple threads. However, I havn't quite grasped threads yet and I was looking for some help/insight.
now I know with this line pthread_create (&tid, &tattr, start_func, arg); that &tid is filled in if its created correctly, and I'm pretty sure &tattr is too. But I have to add in start_func, so does that mean I should put the name of my swap function there?
and is there any way to make the thread take more than 1 arg? my swap function takes 3, the array, and the 2 indeces that need to be checked regarding whether or not they need to be swapped. Or am I looking at arg completely wrong?
now I know with this line pthread_create (&tid, &tattr, start_func, arg); that &tid is filled in if its created correctly, and I'm pretty sure &tattr is too. But I have to add in start_func, so does that mean I should put the name of my swap function there?
and is there any way to make the thread take more than 1 arg? my swap function takes 3, the array, and the 2 indeces that need to be checked regarding whether or not they need to be swapped. Or am I looking at arg completely wrong?