#include <semaphore.h>
sem_t* x;
int main ()
{
x = sem_open("x", O_CREAT, 0, 0);;
sem_wait(x); sem_wait(x); sem_wait(x);
std::cout << "\ndone\n";
}
This code shouldn't even pass the first sem_wait()
but on my system it reaches the end of main()
. Everything I have read, such as here and here, say that, although Mac OS X does not support sem_init()
, it does support sem_open()
. However, using sem_open()
as above hasn't fixed the problem. I'm running OS X 10.5.7.