Lock
Overview
This class represents simple wait lock that allows to block current thread until signal is received.
Use case
You can use this class to wait for different actions to complete
var threadLock := new Lock;
async begin
//perform action on another thread
threadLock.Signal;
end;
//block current thread and wait for other thread to send a signal.
threadLock.WaitFor;
Location
-
Reference:
- RemObjects.Elements.EUnit.dll .NET, .NET Standard 2.0
- remobjects.elements.eunit.jar Cooper
- EUnit.fx Island, macOS
- libEUnit.fx Toffee
- Namespace: RemObjects.Elements.EUnit
- Platforms: .NET, .NET Standard 2.0, Cooper, Island, macOS, Toffee
- Ancestry: AbstractLock | Lock
Instance Methods
Reset override
Sets internal state of the lock to non signaled.
Signal override
Sets internal state to singaled allowing waiting threads to proceed.
WaitFor override
Blocks current thread until signaled.
Blocks current thread until signaled for specified amoun of milliseconds.
method WaitFor(Timeout: Int32): Boolean
Boolean WaitFor(Int32 Timeout)
func WaitFor(_ Timeout: Int32) -> Boolean
Boolean WaitFor(Integer Timeout)
Function WaitFor(Timeout As Int32) As Boolean
Parameters:
- Timeout: The number of milliseconds to wait.