ResultLock<T>
Overview
This class represents wait lock that allows to block current thread until signal is received and return result from that thread.
Use case
You can use this class to wait for different actions to complete
var threadLock := new ResultLock<Boolean>;
async begin
//perform action on another thread
threadLock.Signal(true);
end;
//block current thread and wait for other thread to send a signal.
threadLock.WaitFor;
writeLn(threadLock.Result);
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 | ResultLock<T>
Reset override virtual (declared in Lock) .NET, .NET Standard 2.0, Cooper, Island, macOS
Sets internal state of the lock to non signaled.
method Reset
void Reset()
func Reset()
void Reset()
Sub Reset()
Reset Reset() override (declared in Lock) Toffee
func Reset(Reset )
Parameters:
- :
Result virtual
Gets result returned from a thread.
property Result: T read write;
T Result { get; set; }
var Result: T { get{} set{} }
T Result { __get; __set; }
Property Result() As T
Signal override virtual (declared in Lock) .NET, .NET Standard 2.0, Cooper, Island, macOS
Sets internal state to singaled allowing waiting threads to proceed.
method Signal
void Signal()
func Signal()
void Signal()
Sub Signal()
Signal (T) virtual
Sets specified value as result and changes internal state to singaled allowing waiting threads to proceed.
method Signal(aResult: T)
void Signal(T aResult)
func Signal(_ aResult: T)
void Signal(T aResult)
Sub Signal(aResult As T)
Parameters:
- aResult: Result returned from a thread.
Signal Signal() override (declared in Lock) Toffee
func Signal(Signal )
Parameters:
- :
WaitFor override virtual (declared in Lock) .NET, .NET Standard 2.0, Cooper, Island, macOS
Blocks current thread until signaled.
method WaitFor
void WaitFor()
func WaitFor()
void WaitFor()
Sub WaitFor()
Blocks current thread until signaled for specified amoun of milliseconds.
Parameters:
- Timeout: The number of milliseconds to wait.
WaitFor WaitFor() override (declared in Lock) Toffee
func WaitFor(WaitFor )
Parameters:
- :
Result virtual
Gets result returned from a thread.
property Result: T read write;
T Result { get; set; }
var Result: T { get{} set{} }
T Result { __get; __set; }
Property Result() As T
Reset override virtual (declared in Lock) .NET, .NET Standard 2.0, Cooper, Island, macOS
Sets internal state of the lock to non signaled.
method Reset
void Reset()
func Reset()
void Reset()
Sub Reset()
Reset Reset() override (declared in Lock) Toffee
func Reset(Reset )
Parameters:
- :
Signal override virtual (declared in Lock) .NET, .NET Standard 2.0, Cooper, Island, macOS
Sets internal state to singaled allowing waiting threads to proceed.
method Signal
void Signal()
func Signal()
void Signal()
Sub Signal()
Signal (T) virtual
Sets specified value as result and changes internal state to singaled allowing waiting threads to proceed.
method Signal(aResult: T)
void Signal(T aResult)
func Signal(_ aResult: T)
void Signal(T aResult)
Sub Signal(aResult As T)
Parameters:
- aResult: Result returned from a thread.
Signal Signal() override (declared in Lock) Toffee
func Signal(Signal )
Parameters:
- :
WaitFor override virtual (declared in Lock) .NET, .NET Standard 2.0, Cooper, Island, macOS
Blocks current thread until signaled.
method WaitFor
void WaitFor()
func WaitFor()
void WaitFor()
Sub WaitFor()
Blocks current thread until signaled for specified amoun of milliseconds.
Parameters:
- Timeout: The number of milliseconds to wait.
WaitFor WaitFor() override (declared in Lock) Toffee
func WaitFor(WaitFor )
Parameters:
- :