pthread and semaphore not working for me in osx maverick 10.9

只谈情不闲聊 提交于 2019-12-01 11:11:29

Unnamed POSIX semaphores are not supported on OSX. If you check your return codes you will see sem_init fail with an error along those lines. You need to use named semaphores.

Use sem_open instead of sem_init. Don't use sem_destroy but rather sem_close and sem_unlink.

You will be good to go.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!