In the following program, what are the possibilities for the ordering of threads? Assuming "function" will print thread id which is unique (since here we have only one process). I always get the order th1,th2!
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
int main()
{
pthread_t th1;
pthread_t th2;
pthread_create(&th1, NULL, function, NULL);
pthread_create(&th2, NULL, function, NULL);
pthread_join(th1, NULL);
pthread_join(th2, NULL);
}
return 0;
}