I am looking at changing code that I would like to run on Linux, Unix, and OSX. There are some calls in the code for sem_init, but the value of pshared is zero. I read in Rochkind's book on unix programming, and he basically said that sem_init, which is not generic, is the same as pthread_mutex_init because it acts in binary form in memory.
Question: can I change this sem_init to pthread_mutex_init or use sem_open to get a more portable version of this code?
OSX does not support unnamed semaphores, but I think the other two. I really don't want to have a separate compilation flag for #ifdef(__APPLE__) or something else.
thanks
Derek source share