BusyBlockingCollection
QuantConnect.Util.BusyBlockingCollection
BusyBlockingCollection()
BusyBlockingCollection(bounded_capacity: int)
Bases: Generic[QuantConnect_Util_BusyBlockingCollection_T], Object, IBusyCollection[QuantConnect_Util_BusyBlockingCollection_T]
A small wrapper around BlockingCollection{T} used to communicate busy state of the items being processed
Signature descriptions:
-
Initializes a new instance of the BusyBlockingCollection{T} class with a bounded capacity of int.MaxValue
-
Initializes a new instance of the BusyBlockingCollection{T} class with the specified bounded_capacity
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bounded_capacity
|
Optional[int]
|
The maximum number of items allowed in the collection |
None
|
wait_handle
wait_handle: WaitHandle
Gets a wait handle that can be used to wait until this instance is done processing all of it's item
count
count: int
Gets the number of items held within this collection
is_busy
is_busy: bool
Returns true if processing, false otherwise
add
add(
item: QuantConnect_Util_BusyBlockingCollection_T,
) -> None
add(
item: QuantConnect_Util_BusyBlockingCollection_T,
cancellation_token: CancellationToken,
) -> None
Adds the items to this collection
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
QuantConnect_Util_BusyBlockingCollection_T
|
The item to be added |
required |
cancellation_token
|
Optional[CancellationToken]
|
A cancellation token to observer |
None
|
get_consuming_enumerable
get_consuming_enumerable() -> (
Iterable[QuantConnect_Util_BusyBlockingCollection_T]
)
get_consuming_enumerable(
cancellation_token: CancellationToken,
) -> Iterable[QuantConnect_Util_BusyBlockingCollection_T]
Provides a consuming enumerable for items in this collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cancellation_token
|
Optional[CancellationToken]
|
A cancellation token to observer |
None
|
Returns:
| Type | Description |
|---|---|
Iterable[QuantConnect_Util_BusyBlockingCollection_T]
|
An enumerable that removes and returns items from the collection. |
complete_adding
complete_adding() -> None
Marks the BusyBlockingCollection{T} as not accepting any more additions
dispose
dispose() -> None
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.