Wait_Semaphore

include vmm.inc

mov     eax, SemaphoreHandle
mov     ecx, Flags
VMMCall Wait_Semaphore
 

Blocks the current thread until the semaphore is signaled using the Signal_Semaphore service. Uses Flags

SemaphoreHandle
Handle of the semaphore on which to wait.
Flags
Action to take when interrupts occur while the thread is blocked waiting for the semaphore. This parameter can be a combination of the following values:
Block_Enable_Ints Service interrupts in the virtual machine even if the virtual machine does not currently have interrupts enabled. This forces interrupts to be enabled. This value is only relevant if either Block_Svc_Ints or Block_Svc_If_Ints_Locked is set.
Block_Force_Svc_Ints Service events and simulated interrupts in the thread even when the critical section is not available. Be careful when using this flag. If it is used when any VMM or real mode MS-DOS resources are held, it will cause deadlocks to occur. If in doubt, do not use this flag.
Block_Poll Do not switch away from the blocked virtual machine unless another virtual machine has higher priority.
Block_Svc_If_Ints_Locked Service events and simulated interrupts in the virtual machine even if the thread blocks for the semaphore and the VMStat_V86IntsLocked flag is set.
Block_Svc_Ints Service events and simulated interrupts in the virtual machine even if the virtual machine is blocked. Events are only serviced when the critical section is available or owned by the blocked thread unless the Block_Force_Svc_Ints flag is also set. Then when events are serviced, the critical section is taken and held while they are serviced. This is necessary to prevent a deadlock from occurring when an event tries to enter the critical section and blocks while holding system-wide resources.
Block_Thread_Idle Consider the thread idle when it blocks on the semaphore.

This service blocks if the semaphore's token count is zero or less. Otherwise, it decrements the token count and returns immediately. If the token count is not zero (meaning the Signal_Semaphore service has been called), Wait_Semaphore decrements the token count and returns immediately.

See Also

Create_Semaphore, Signal_Semaphore