SuperTinyKernel™ RTOS 1.05.3
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::test::MutexMock Struct Reference

#include <stktest.h>

Inheritance diagram for stk::test::MutexMock:
Collaboration diagram for stk::test::MutexMock:

Public Member Functions

 MutexMock ()
void Lock ()
 Lock the mutex.
void Unlock ()
 Unlock the mutex.

Public Attributes

uint32_t m_nesting
bool m_locked

Detailed Description

Definition at line 362 of file stktest.h.

Constructor & Destructor Documentation

◆ MutexMock()

stk::test::MutexMock::MutexMock ( )
inlineexplicit

Definition at line 364 of file stktest.h.

364 : m_nesting(0), m_locked(false)
365 {}

References m_locked, and m_nesting.

Member Function Documentation

◆ Lock()

void stk::test::MutexMock::Lock ( )
inlinevirtual

Lock the mutex.

Implements stk::IMutex.

Definition at line 370 of file stktest.h.

371 {
372 if (m_nesting == 0)
373 m_locked = true;
374
375 ++m_nesting;
376 }

References m_locked, and m_nesting.

◆ Unlock()

void stk::test::MutexMock::Unlock ( )
inlinevirtual

Unlock the mutex.

Implements stk::IMutex.

Definition at line 378 of file stktest.h.

379 {
380 STK_ASSERT(m_nesting != 0);
381
382 if (--m_nesting == 0)
383 m_locked = false;
384 }
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
Definition stk_defs.h:330

References m_locked, m_nesting, and STK_ASSERT.

Member Data Documentation

◆ m_locked

bool stk::test::MutexMock::m_locked

Definition at line 368 of file stktest.h.

Referenced by Lock(), MutexMock(), and Unlock().

◆ m_nesting

uint32_t stk::test::MutexMock::m_nesting

Definition at line 367 of file stktest.h.

Referenced by Lock(), MutexMock(), and Unlock().


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