Semop: When decreasing a set of semaphores are all decremented at once or does it block on first failure?

十年热恋 提交于 2019-12-05 11:12:49

No updates happen until all updates can proceed as a unit.

The POSIX specification could be clearer about this point, although it does say that semop is atomic.

On Linux, semop(3) in glibc is a simple wrapper around semop(2). The semop(2) manpage in turn says

The set of operations contained in sops is performed in array order, and atomically, that is, the operations are performed either as a complete unit, or not at all.

The HP-UX semop(2) manpage is even clearer:

Semaphore array operations are atomic in that none of the semaphore operations are performed until blocking conditions on all of the semaphores in the array have been removed.

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