diff --git a/reader_concurrency_semaphore.hh b/reader_concurrency_semaphore.hh index 5b721963e4..a364117201 100644 --- a/reader_concurrency_semaphore.hh +++ b/reader_concurrency_semaphore.hh @@ -179,8 +179,10 @@ private: signal(resources(0, static_cast(memory))); } public: - reader_concurrency_semaphore(unsigned count, - size_t memory, + struct no_limits { }; + + reader_concurrency_semaphore(int count, + ssize_t memory, size_t max_queue_length = std::numeric_limits::max(), std::function raise_queue_overloaded_exception = default_make_queue_overloaded_exception) : _resources(count, memory) @@ -188,6 +190,13 @@ public: , _make_queue_overloaded_exception(raise_queue_overloaded_exception) { } + /// Create a semaphore with practically unlimited count and memory. + /// + /// And conversely, no queue limit either. + explicit reader_concurrency_semaphore(no_limits) + : reader_concurrency_semaphore(std::numeric_limits::max(), std::numeric_limits::max()) { + } + reader_concurrency_semaphore(const reader_concurrency_semaphore&) = delete; reader_concurrency_semaphore& operator=(const reader_concurrency_semaphore&) = delete; diff --git a/tests/querier_cache.cc b/tests/querier_cache.cc index f7a3e06b59..5a9e04a9d1 100644 --- a/tests/querier_cache.cc +++ b/tests/querier_cache.cc @@ -158,7 +158,7 @@ public: }; test_querier_cache(const noncopyable_function& external_make_value, std::chrono::seconds entry_ttl = 24h, size_t cache_size = 100000) - : _sem(std::numeric_limits::max(), std::numeric_limits::max()) + : _sem(reader_concurrency_semaphore::no_limits{}) , _cache(_sem, cache_size, entry_ttl) , _mutations(make_mutations(_s, external_make_value)) , _mutation_source([this] (schema_ptr, const dht::partition_range& range) {