If the following pieces of code execute in the order in which I have put them, can I be sure that thread 1 is awoken first by thread 3, later followed by thread 2?
main:
sem_init(&x,0,0);
thread 1:
sem_wait(&x);
thread 2:
sem_wait(&x);
thread 3:
sem_post(&x);