ExceptionLock

Overview

This class represents wait lock that allows to block current thread until signal is received and raise exception returned from that thread.

Use case

You can use this class to wait for different actions to complete

var threadLock := new ExceptionLock;

async begin  
  try
     //perform action on another thread
     threadLock.Signal(nil);  
  except
    on E: Exception do
      threadLock.Signal(E);
  end;
end;

//block current thread and wait for other thread to send a signal.
threadLock.WaitFor;

Location

 

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    (declared in ResultLock<T>)

Gets result returned from a thread.

 

property Result: Exception read write;

 

Exception Result { get; set; }

 

// .NET, .NET Standard 2.0, Island, macOS
var Result: Exception { get{} set{} }
// Toffee
var Result: NSException { get{} set{} }

 

Exception Result { __get; __set; }

 

Property Result() As Exception

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 (Exception)  virtual    (declared in ResultLock<T>)

Sets specified value as result and changes internal state to singaled allowing waiting threads to proceed.

 

method Signal(aResult: Exception)

 

void Signal(Exception aResult)

 

func Signal(_ aResult: NSException)

 

void Signal(Exception aResult)

 

Sub Signal(aResult As Exception)

Parameters:

  • aResult: Result returned from a thread.

Signal Signal()  override    (declared in Lock) Toffee

 

func Signal(Signal )

Parameters:

  • :

WaitFor  override virtual .NET, .NET Standard 2.0, Cooper, Island, macOS

Blocks current thread until signaled. If thread returns exception object it will be rethrown by this method.

 

method WaitFor

 

void WaitFor()

 

func WaitFor()

 

void WaitFor()

 

Sub WaitFor()

WaitFor (Int32): Boolean  override

Blocks current thread until signaled for specified amoun of milliseconds. If thread returns exception object it will be rethrown by this method.

 

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.

WaitFor WaitFor()  override Toffee

 

func WaitFor(WaitFor )

Parameters:

  • :

 

Result  virtual    (declared in ResultLock<T>)

Gets result returned from a thread.

 

property Result: Exception read write;

 

Exception Result { get; set; }

 

// .NET, .NET Standard 2.0, Island, macOS
var Result: Exception { get{} set{} }
// Toffee
var Result: NSException { get{} set{} }

 

Exception Result { __get; __set; }

 

Property Result() As Exception

 

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 (Exception)  virtual    (declared in ResultLock<T>)

Sets specified value as result and changes internal state to singaled allowing waiting threads to proceed.

 

method Signal(aResult: Exception)

 

void Signal(Exception aResult)

 

func Signal(_ aResult: NSException)

 

void Signal(Exception aResult)

 

Sub Signal(aResult As Exception)

Parameters:

  • aResult: Result returned from a thread.

Signal Signal()  override    (declared in Lock) Toffee

 

func Signal(Signal )

Parameters:

  • :

WaitFor  override virtual .NET, .NET Standard 2.0, Cooper, Island, macOS

Blocks current thread until signaled. If thread returns exception object it will be rethrown by this method.

 

method WaitFor

 

void WaitFor()

 

func WaitFor()

 

void WaitFor()

 

Sub WaitFor()

WaitFor (Int32): Boolean  override

Blocks current thread until signaled for specified amoun of milliseconds. If thread returns exception object it will be rethrown by this method.

 

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.

WaitFor WaitFor()  override Toffee

 

func WaitFor(WaitFor )

Parameters:

  • :