- 论坛徽章:
- 0
|
请教给位老大:ULK2中描述信号量获取的__down()函数时,回唤醒另一个等待进程,如果说唤醒另一个进程只是为了设置count和sleepers字段,那and terminates holding the semaphore这句话是什么意思?为什么要中止所持有的信号量?
原文如下:If the count field is not negative, the function sets sleepers to 0 and exits from the loop. It tries to wake up another process in the semaphore wait queue (but in our scenario, the queue is now empty) and terminates holding the semaphore. On exit, both the count field and the sleepers field are set to 0, as required when the semaphore is closed but no process is waiting for it. |
|