要等待某个事件,则可以使用 semop() 函数,并将 sem_op 的值设置为 -1,这样就可以阻塞调用进程,直到它变为有信号状态为止。
To wait on an event, semop() function is used with sem_op value as -1 thus blocking the calling process until it is signaled.
阻塞进程的最后计数将从这个调用中输出。
The final count of blocking processes is output from this call.
有时你还不得不选择一个专门的进程来等待阻塞调用来结束这些,你的其它代码也随之结束。
Sometimes, you have no choice but to delegate a victim thread to wait for a blocking call to finish, while the rest of your code gets on with its life.
应用推荐