Currently Being ModeratedFeb 8, 2013 6:53 AM (in response to Dhiraj Bhor)
Wrong semaphore. That is a real-time API. If you check errno you will see that it says it is not implemented. Use the SYS V IPC versions like semget and semop.
Currently Being ModeratedFeb 10, 2013 8:59 PM (in response to etresoft)
@etresoft Thanks. I get my solution by sem_unlink before sem_init or sem_open
But why mac developers had done such unimplemented stuff. It becomes difficult to even get one simple
example to understand the concept or to get started?
Currently Being ModeratedFeb 11, 2013 11:52 AM (in response to Dhiraj Bhor)
As I said above, that is a realtime extension. OS X is not a realtime operating system and has many other concurrency APIs, pretty much all of which are better.
Currently Being ModeratedFeb 12, 2013 1:26 AM (in response to etresoft)
I am novice and i don't know much about what you are saying.
But wheather i am using wrong way for semaphores on OSX?
Currently Being ModeratedFeb 12, 2013 4:58 AM (in response to Dhiraj Bhor)
You are trying to use a specific, newer type of semaphore that is meant for realtime systems like VxWorks. Linux includes it too, even though Linux isn't any more realtime than OS X. The original semaphore idea belongs to Edsger Dijkstra from 1965. It really isn't used anymore in new development. The state of the art in concurrency is Apple's Grand Central Dispatch.