i have a log function which is called just after sem_post(&sem_ptr)
:
sem_post(&sem_ptr);
write(STD_OUT, "blah", 5);
when i use these sequence of code, i mean calling write
after sem_post
,
sometimes the "blah" string is printed twice, but when i use the following sequence of code:
write(STD_OUT, "blah", 5);
sem_post(&sem_ptr);
the output is correct and the "blah" string is printed once. can somebody explain this behaviour?