更新时间:2023-01-20 09:02:09
OSX不支持未命名的POSIX信号灯.如果检查返回码,您将看到sem_init
失败,并在这些行上出现错误.您需要使用命名信号量.
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.
使用sem_open
代替sem_init
.不要使用sem_destroy
,而是使用sem_close和sem_unlink
.
Use sem_open
instead of sem_init
. Don't use sem_destroy
but rather sem_close and sem_unlink
.
您会很高兴.