libtcspc.RecyclingBucketSource¶
- class libtcspc.RecyclingBucketSource(object_type, *, blocking=False, clear_recycled=False, max_bucket_count=None)[source]¶
Bases:
BucketSourceBucket source that reuses storage from destroyed buckets.
Storage allocated for a bucket is returned to an internal pool when the bucket is destroyed and may be reused for a subsequent request, avoiding repeated allocation.
- Parameters:
object_type (EventType) – Element type of the buckets produced by this source.
blocking (bool, keyword-only) – Behavior when
max_bucket_countoutstanding buckets exist and a new one is requested.Trueblocks until a bucket is recycled;False(the default) raises an overflow error.clear_recycled (bool, keyword-only) – If
True, recycled storage is cleared before reuse. DefaultFalse.max_bucket_count (int or Param[int] or None, keyword-only) – Maximum number of outstanding buckets.
None(the default) is unlimited. Must be non-negative.
- Raises:
ValueError – If
max_bucket_countis a negative integer, or aParamwhosedefault_valueis negative.
Notes
Thread-safe. When
max_bucket_countis set, at least two buckets must be allowed to circulate to avoid deadlock.See also
- tcspc::recycling_bucket_source
The underlying C++ bucket source.
- NewDeleteBucketSource
Bucket source without recycling.