Как передать несколько параметров в поток в C

Я пытаюсь передать два параметра потоку на C. Я создал массив (размером 2) и пытаюсь передать этот массив в поток. Правильный ли это подход к передаче нескольких параметров в поток?

// parameters of input. These are two random numbers 
int track_no = rand()%15; // getting the track number for the thread
int number = rand()%20 + 1; // this represents the work that needs to be done
int *parameters[2];
parameters[0]=track_no;
parameters[1]=number;

// the thread is created here 
pthread_t server_thread;
int server_thread_status;
//somehow pass two parameters into the thread
server_thread_status = pthread_create(&server_thread, NULL, disk_access, parameters);
12
задан alk 22 November 2011 в 09:42
поделиться