SuperTinyKernel™ RTOS
1.06.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk_sync_cs.h
Go to the documentation of this file.
1
/*
2
* SuperTinyKernel(TM) RTOS: Lightweight High-Performance Deterministic C++ RTOS for Embedded Systems.
3
*
4
* Source: https://github.com/SuperTinyKernel-RTOS
5
*
6
* Copyright (c) 2022-2026 Neutron Code Limited <stk@neutroncode.com>. All Rights Reserved.
7
* License: MIT License, see LICENSE for a full text.
8
*/
9
10
#ifndef STK_SYNC_CS_H_
11
#define STK_SYNC_CS_H_
12
13
#include "
stk_helper.h
"
14
18
19
namespace
stk
{
20
namespace
sync
{
21
53
class
ScopedCriticalSection
final :
public
IMutex
54
{
55
friend
class
Event
;
56
friend
class
EventFlags
;
57
friend
class
Mutex
;
58
friend
class
RWMutex
;
59
friend
class
Semaphore
;
60
friend
class
Pipe
;
61
template
<
typename
T,
size_t
N>
friend
class
PipeT
;
62
63
public
:
66
explicit
ScopedCriticalSection
() {
Lock
(); }
67
71
STK_VIRT_DTOR
~ScopedCriticalSection
() {
Unlock
(); }
72
73
private
:
74
STK_NONCOPYABLE_CLASS
(
ScopedCriticalSection
);
75
76
void
Lock
()
override
{
hw::CriticalSection::Enter
(); }
77
void
Unlock
()
override
{
hw::CriticalSection::Exit
(); }
78
};
79
80
}
// namespace sync
81
}
// namespace stk
82
83
#endif
/* STK_SYNC_CS_H_ */
STK_VIRT_DTOR
#define STK_VIRT_DTOR
Makes destructors virtual and compliant to strict rules if STK_STRICT_COMPLIANCY=0.
Definition
stk_defs.h:159
stk_helper.h
Contains helper implementations which simplify user-side code.
stk
Namespace of STK package.
Definition
stk_arch_arm-cortex-m.h:19
stk::sync
Synchronization primitives for task coordination and resource protection.
stk::hw::CriticalSection::Enter
static void Enter()
Enter a critical section.
stk::hw::CriticalSection::Exit
static void Exit()
Exit a critical section.
stk::IMutex
Interface for mutex synchronization primitive.
Definition
stk_common.h:542
stk::sync::ScopedCriticalSection::Mutex
friend class Mutex
Definition
stk_sync_cs.h:57
stk::sync::ScopedCriticalSection::ScopedCriticalSection
ScopedCriticalSection()
Enters critical section.
Definition
stk_sync_cs.h:66
stk::sync::ScopedCriticalSection::EventFlags
friend class EventFlags
Definition
stk_sync_cs.h:56
stk::sync::ScopedCriticalSection::Event
friend class Event
Definition
stk_sync_cs.h:55
stk::sync::ScopedCriticalSection::~ScopedCriticalSection
STK_VIRT_DTOR ~ScopedCriticalSection()
Exits critical section.
Definition
stk_sync_cs.h:71
stk::sync::ScopedCriticalSection::Pipe
friend class Pipe
Definition
stk_sync_cs.h:60
stk::sync::ScopedCriticalSection::Unlock
void Unlock() override
Unlock the mutex.
Definition
stk_sync_cs.h:77
stk::sync::ScopedCriticalSection::Semaphore
friend class Semaphore
Definition
stk_sync_cs.h:59
stk::sync::ScopedCriticalSection::RWMutex
friend class RWMutex
Definition
stk_sync_cs.h:58
stk::sync::ScopedCriticalSection::Lock
void Lock() override
Lock the mutex.
Definition
stk_sync_cs.h:76
stk::sync::ScopedCriticalSection::STK_NONCOPYABLE_CLASS
STK_NONCOPYABLE_CLASS(ScopedCriticalSection)
stk::sync::ScopedCriticalSection::PipeT
friend class PipeT
Definition
stk_sync_cs.h:61
stk
include
sync
stk_sync_cs.h
Generated by
1.16.1