SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::IMutex Class Referenceabstract

Interface for mutex synchronization primitive. More...

#include <stk_common.h>

Inheritance diagram for stk::IMutex:
Collaboration diagram for stk::IMutex:

Classes

class  ScopedLock
 Locks bound mutex within a scope of execution. Ensures the mutex is always unlocked when leaving the scope, even when exceptions are thrown. More...

Public Member Functions

virtual void Lock ()=0
 Lock the mutex.
virtual void Unlock ()=0
 Unlock the mutex.
virtual bool TryLock ()=0
 Try locking the mutex in a single non-blocking attempt.

Protected Member Functions

 ~IMutex ()=default
 Destructor.

Detailed Description

Interface for mutex synchronization primitive.

Note
Implementations may be either recursive or non-recursive.

Definition at line 816 of file stk_common.h.

Constructor & Destructor Documentation

◆ ~IMutex()

stk::IMutex::~IMutex ( )
protecteddefault

Destructor.

Note
Protected by design. Prevents unsafe polymorphic delete.

Member Function Documentation

◆ Lock()

virtual void stk::IMutex::Lock ( )
pure virtual

◆ TryLock()

virtual bool stk::IMutex::TryLock ( )
pure virtual

Try locking the mutex in a single non-blocking attempt.

Returns
true if the lock was acquired; false if it was already held by another thread/core.

Implemented in stk::sync::FastMutex, stk::sync::Mutex, stk::sync::RWMutex, stk::sync::ScopedCriticalSection, and stk::sync::SpinLock.

◆ Unlock()

virtual void stk::IMutex::Unlock ( )
pure virtual

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