![]() |
OpenMS
|
Counting semaphore for paths that still stream one SWATH per worker. More...
#include <OpenMS/ANALYSIS/OPENSWATH/OpenSwathWorkflowScheduler.h>
Public Member Functions | |
| ConcurrencyLimiter (Size max_concurrent_swaths) | |
Construct with the upper bound on concurrent slots; values < 1 are clamped to 1. | |
| void | acquireSlot () |
| Block until a slot is free and reserve it. Wakes via the condition variable. | |
| void | releaseSlot () |
| Release a previously reserved slot and notify one waiter. No-op (safe) if the active count is already zero. | |
Private Attributes | |
| Size | max_concurrent_swaths_ |
| Size | active_swaths_ = 0 |
| std::mutex | mutex_ |
| std::condition_variable | cv_ |
Counting semaphore for paths that still stream one SWATH per worker.
A small wrapper around a std::mutex + std::condition_variable pair that enforces an upper bound on concurrently-active slots. The constructor clamps the requested cap to max(1, max_concurrent_swaths) so callers don't accidentally configure an unreachable limit. Not copyable nor movable (inherited from the mutex and condition variable members).
Pair with ScopedSlot for RAII slot management instead of calling acquireSlot / releaseSlot directly.
|
explicit |
Construct with the upper bound on concurrent slots; values < 1 are clamped to 1.
| void acquireSlot | ( | ) |
Block until a slot is free and reserve it. Wakes via the condition variable.
| void releaseSlot | ( | ) |
Release a previously reserved slot and notify one waiter. No-op (safe) if the active count is already zero.
|
private |
|
private |
|
private |
|
private |