Why is there a while loop in wait function of a semaphore, when if can be used too?

后端 未结 0 955
既然无缘
既然无缘 2020-12-11 03:56

this is my code:

wait(){
    while(S<=0)
       //puts the thread in the block list until it wakes up(by calling post)
    S = S-1
 }

ther

相关标签:
回答
  • 消灭零回复
提交回复
热议问题