How can i save the id of p_thread to an array?
int i;
pthread_t t[N];
float arrayId[N];
for (i = 0; i < N; i++) {
pthread_create(&t[i], NULL, f, (void *) &i);
printf("creato il thread id=%lu\n", t[i]);
arrayId[i] = t[i];
printf("a[%d]=%f\n", i, arrayId[i]);
}
I can print it, but i'm not able to save...
I'll have to sort this array and then i'll have to execute first all the thread ordered by id