sem_init is not working on Mac OSX 10.6.4(Snow Leopard)
I am writing code that will solve readers writers problem but when i use sem_init to initialise unnamed semaphore,
it returns -1 my code is
sem_t sem;
main()
{
int ret;
ret = sem_init(&sem, 0, 1);
printf("Return %d\n", ret);
}
Is there any mistake with my code please let me know.If not provide me with suggestions to solve this problem?
Mac mini, Mac OS X (10.6.4)