Module Stateful.Concurrent_pool

type 'a t

A thread-safe pool of previously generated values.

val create : ?clone:('a -> 'a) -> test_case -> 'a t

Creates an empty pool. Pools are tied to a test case. Do not reuse one across test cases. Drawn mutable values are shared by default. Pass a copying function for independent mutable values. Consumed draws return the stored value directly. clone must not call back into the same pool.

val add : 'a t -> test_case -> 'a -> unit

add pool tc value records value in pool.

val size : _ t -> int

Returns the number of values in the pool.

val values_reusable : 'a t -> ('a, Generators.unprintable) Generators.generator

Draws a value without removing it. A draw from an empty pool rejects the current rule.

val values_consumed : 'a t -> ('a, Generators.unprintable) Generators.generator

Draws and removes a value. A draw from an empty pool rejects the current rule.