Class ObjectQueue<T>
Represents a first-in, first-out queue for a generic object type. The queue implemented by this class is thread-safe, and it also blocks readers in case of an empty queue. This queue has especially been designed to act as a work queue in multi-threaded applications.
Inheritance
Inherited Members
Namespace: Juhta.Net.Common
Assembly: Juhta.Net.dll
Syntax
public class ObjectQueue<T>
Type Parameters
Name | Description |
---|---|
T | Specifies an object type. |
Constructors
| Improve this Doc View SourceObjectQueue()
Initializes a new instance.
Declaration
public ObjectQueue()
Properties
| Improve this Doc View SourceCount
Gets the number of elements contained in the object queue specified by this ObjectQueue instance.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceClose()
Closes the object queue specified by this ObjectQueue instance. The operation releases all threads that are blocked by the current instance.
Declaration
public void Close()
GetObject()
Gets the next object from the object queue specified by this ObjectQueue instance.
Declaration
public T GetObject()
Returns
Type | Description |
---|---|
T | Returns the next instance of T from the queue. The return value is null only, if the queue was initially empty and the queue had been closed prior to the call or no object became available before the queue was closed during the call. |
PutObject(T)
Puts an object to the object queue specified by this ObjectQueue instance.
Declaration
public void PutObject(T object)
Parameters
Type | Name | Description |
---|---|---|
T | object | Specifies an object. |