OpenMS
Loading...
Searching...
No Matches
OpenSwathWorkflowScheduler::ScopedSlot Class Reference

RAII slot guard for ConcurrencyLimiter — acquires on construction, releases on destruction. More...

#include <OpenMS/ANALYSIS/OPENSWATH/OpenSwathWorkflowScheduler.h>

Collaboration diagram for OpenSwathWorkflowScheduler::ScopedSlot:
[legend]

Public Member Functions

 ScopedSlot (ConcurrencyLimiter *limiter)
 Acquire a slot from limiter (blocking). If limiter is nullptr, the constructor is a no-op.
 
 ~ScopedSlot ()
 Release the slot back to the limiter (no-op if constructed with nullptr).
 
 ScopedSlot (const ScopedSlot &)=delete
 
ScopedSlotoperator= (const ScopedSlot &)=delete
 

Private Attributes

ConcurrencyLimiterlimiter_
 

Detailed Description

RAII slot guard for ConcurrencyLimiter — acquires on construction, releases on destruction.

The constructor calls ConcurrencyLimiter::acquireSlot on limiter (which may block); the destructor calls ConcurrencyLimiter::releaseSlot. Passing nullptr makes both operations no-ops, so guard sites that may or may not be limited can be written without branching. Not copyable nor movable.

Constructor & Destructor Documentation

◆ ScopedSlot() [1/2]

ScopedSlot ( ConcurrencyLimiter limiter)
explicit

Acquire a slot from limiter (blocking). If limiter is nullptr, the constructor is a no-op.

◆ ~ScopedSlot()

~ScopedSlot ( )

Release the slot back to the limiter (no-op if constructed with nullptr).

◆ ScopedSlot() [2/2]

ScopedSlot ( const ScopedSlot )
delete

Member Function Documentation

◆ operator=()

ScopedSlot & operator= ( const ScopedSlot )
delete

Member Data Documentation

◆ limiter_

ConcurrencyLimiter* limiter_
private