public class BlockingCell

Summary

A thread-safe single-assignment reference cell.

Remarks

A fresh BlockingCell holds no value (is empty). Any thread reading the Value property when the cell is empty will block until a value is made available by some other thread. The Value property can only be set once - on the first call, the BlockingCell is considered full, and made immutable. Further attempts to set Value result in a thrown InvalidOperationException.

Property Summary

Flags Type Name Summary
public object Value (rw)

Retrieve the cell's value, blocking if none exists at present, or supply a value to an empty cell, thereby filling it.

Constructor Summary

Flags Name Summary
public BlockingCell()

(undocumented)

Method Summary

Flags Name Summary
public object GetValue(TimeSpan timeout)

Retrieve the cell's value, waiting for the given timeout if no value is immediately available.

public object GetValue(int timeout)

Retrieve the cell's value, waiting for the given timeout if no value is immediately available.

public static int validatedTimeout(int timeout)

Return valid timeout value

Property Detail

public object Value (rw)

Summary

Retrieve the cell's value, blocking if none exists at present, or supply a value to an empty cell, thereby filling it.

Exception

Constructor Detail

BlockingCell

public BlockingCell()

Method Detail

GetValue

public object GetValue(TimeSpan timeout)

Flags public
Return type object
Parameters
Name Type
timeout TimeSpan

Summary

Retrieve the cell's value, waiting for the given timeout if no value is immediately available.

Remarks

If a value is present in the cell at the time the call is made, the call will return immediately. Otherwise, the calling thread blocks until either a value appears, or operation times out.

If no value was available before the timeout, an exception is thrown.

GetValue

public object GetValue(int timeout)

Flags public
Return type object
Parameters
Name Type
timeout int

Summary

Retrieve the cell's value, waiting for the given timeout if no value is immediately available.

Remarks

If a value is present in the cell at the time the call is made, the call will return immediately. Otherwise, the calling thread blocks until either a value appears, or operation times out.

If no value was available before the timeout, an exception is thrown.

validatedTimeout

public static int validatedTimeout(int timeout)

Flags public static
Return type int
Parameters
Name Type
timeout int

Summary

Return valid timeout value

Remarks

If value of the parameter is less then zero, return 0 to mean infinity