Waits until the specified object is in the signaled state or until the time-out interval elapses.
Kernel.bdh
WaitForSingleObject( in hHandle : number, in nTimeoutMs : number ): number;
WAIT_ABANDONED. The specified object is a mutex object that was not released by the thread that owned the mutex object before the owning thread terminated. Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled.
WAIT_OBJECT_0. The state of the specified object is signaled.
WAIT_TIMEOUT. The time-out interval has elapsed and the object's state is nonsignaled.
Parameter | Description |
---|---|
hHandle | Handle of the object |
nTimeoutMs |
Specifies the time-out interval, in milliseconds
|
dcltrans transaction TCloseHandle var hMutex: number; begin hMutex := CreateMutex("MutexObject"); write("mutex object created"); writeln; WaitForSingleObject(hMutex, INFINITE); ReleaseMutex(hMutex); write("mutex object released"); writeln; CloseHandle(hMutex); write("handle to mutex object closed"); writeln; end TCloseHandle;
mutex object created mutex object released handle to mutex object closed
Trans.bdf, MutexLogin.bdf