Class BlockingCell
A thread-safe single-assignment reference cell.
Inheritance
Inherited Members
Namespace: RabbitMQ.Util
Assembly: RabbitMQ.Client.WinRT.dll
Syntax
public class BlockingCell
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.
Properties
| Improve this Doc View SourceValue
Retrieve the cell's value, blocking if none exists at present, or supply a value to an empty cell, thereby filling it.
Declaration
public object Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException |
Methods
| Improve this Doc View SourceGetValue(Int32)
Retrieve the cell's value, waiting for the given timeout if no value is immediately available.
Declaration
public object GetValue(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout |
Returns
Type | Description |
---|---|
System.Object |
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(TimeSpan)
Retrieve the cell's value, waiting for the given timeout if no value is immediately available.
Declaration
public object GetValue(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeout |
Returns
Type | Description |
---|---|
System.Object |
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(Int32)
Return valid timeout value
Declaration
public static int validatedTimeout(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout |
Returns
Type | Description |
---|---|
System.Int32 |
Remarks
If value of the parameter is less then zero, return 0 to mean infinity