semaphore on MacOS

semaphore on MacOS



the below post is to fix sem_init() problem




sem_init() is not working in MacOS

sem_open may produce "sem_open: Permission denied" error

fix is below

instead of sem_init()











    sem_t *mut;//can be global
    sem_unlink("/shsem");//note that shsem can be any text
    reader_lock=sem_open("/shsem", O_CREAT | O_EXCL, 0777, 1);



resource: http://stackoverflow.com/questions/15045910/semaphore-permission-denied

Comments

Popular Posts