37 assert(
false &&
"Unexpected exception type");
82 std::queue<std::future<void>>
futures;
87 std::future<void>
fut;
#define Assert(val)
Identity function.
void DisableLogging() EXCLUSIVE_LOCKS_REQUIRED(!m_cs)
Disable logging This offers a slight speedup and slightly smaller memory usage compared to leaving th...
T ConsumeIntegralInRange(T min, T max)
Fixed-size thread pool for running arbitrary tasks concurrently.
void Start(int num_workers) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Start worker threads.
size_t WorkersCount() EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
size_t WorkQueueSize() EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
util::Expected< std::future< std::invoke_result_t< F > >, SubmitError > Submit(F &&fn) noexcept EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Enqueues a new task for asynchronous execution.
BCLog::Logger & LogInstance()
std::atomic_uint32_t & m_counter
CounterTask(std::atomic_uint32_t &counter)
ExpectedException(const std::string &msg)
static void setup_threadpool_test()
static void GetFuture(std::future< void > &future, uint32_t &fail_counter)
static void StartPoolIfNeeded() EXCLUSIVE_LOCKS_REQUIRED(!g_pool_mutex)
#define EXCLUSIVE_LOCKS_REQUIRED(...)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
FuzzedDataProvider & fuzzed_data_provider