contur2
Loading...
Searching...
No Matches
contur::ISyncPrimitive Class Referenceabstract

Common interface for synchronization primitives. More...

#include <i_sync_primitive.h>

Inheritance diagram for contur::ISyncPrimitive:

Public Member Functions

virtual ~ISyncPrimitive ()=default
virtual Result< void > acquire (ProcessId pid)=0
 Attempts to acquire the primitive for a process.
virtual Result< void > release (ProcessId pid)=0
 Releases the primitive for a process.
virtual Result< void > tryAcquire (ProcessId pid)=0
 Attempts non-blocking acquire.
virtual std::string_view name () const noexcept=0
 Human-readable primitive name.

Detailed Description

Common interface for synchronization primitives.

Definition at line 14 of file i_sync_primitive.h.

Constructor & Destructor Documentation

◆ ~ISyncPrimitive()

virtual contur::ISyncPrimitive::~ISyncPrimitive ( )
virtualdefault

Member Function Documentation

◆ acquire()

virtual Result< void > contur::ISyncPrimitive::acquire ( ProcessId pid)
nodiscardpure virtual

Attempts to acquire the primitive for a process.

Parameters
pidCaller process ID.
Returns
Ok on success or an error code.

Implemented in contur::CriticalSection, contur::Mutex, and contur::Semaphore.

◆ name()

virtual std::string_view contur::ISyncPrimitive::name ( ) const
nodiscardpure virtualnoexcept

Human-readable primitive name.

Implemented in contur::CriticalSection, contur::Mutex, and contur::Semaphore.

◆ release()

virtual Result< void > contur::ISyncPrimitive::release ( ProcessId pid)
nodiscardpure virtual

Releases the primitive for a process.

Parameters
pidReleasing process ID.
Returns
Ok on success or an error code.

Implemented in contur::CriticalSection, contur::Mutex, and contur::Semaphore.

◆ tryAcquire()

virtual Result< void > contur::ISyncPrimitive::tryAcquire ( ProcessId pid)
nodiscardpure virtual

Attempts non-blocking acquire.

Parameters
pidCaller process ID.
Returns
Ok when acquired, or ResourceBusy/error.

Implemented in contur::CriticalSection, contur::Mutex, and contur::Semaphore.


The documentation for this class was generated from the following file: