Figure 31.17 Implementing Zemaphores with Locks and CVs:
In function Zem_Wait, the code checks first if the value is <=0 and waits. After which it decrements the value. However from the defintions earlier (say figure 31.2):
sem_wait is supposed to decrement the value first and then wait if the value is negative. Is this a typo or am I missing something here?
Figure 31.17 Implementing Zemaphores with Locks and CVs:
In function Zem_Wait, the code checks first if the value is <=0 and waits. After which it decrements the value. However from the defintions earlier (say figure 31.2):
sem_wait is supposed to decrement the value first and then wait if the value is negative. Is this a typo or am I missing something here?