C semaphores: sem_wait throwing inexplicable error

Posted by tocapa on Stack Overflow See other posts from Stack Overflow or by tocapa
Published on 2010-05-02T00:52:40Z Indexed on 2010/05/02 0:57 UTC
Read the original article Hit count: 183

Filed under:
|

I'm working on a problem which we have to use semaphores to solve. I have an array which contains two semaphores, gsem, and given certain conditions call sem_wait(&(gsem[me])), which is supposed to waiting until that particular process is woken up. However, for some reason it gives me the error Bad file descriptor. I looked up sem_wait and the Open Group spec says this is not an error sem_wait can cause. This is making my whole program crazy and I have no idea why this is failing.

© Stack Overflow or respective owner

Related posts about c

    Related posts about semaphore