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_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
:
private
IMutex
54
{
55
friend
class
Event
;
56
friend
class
EventFlags
;
57
friend
class
Mutex
;
58
friend
class
RWMutex
;
59
friend
class
Semaphore
;
60
template
<
typename
T,
size_t
N>
friend
class
Pipe
;
61
62
public
:
65
explicit
ScopedCriticalSection
() {
Lock
(); }
66
70
~ScopedCriticalSection
() {
Unlock
(); }
71
72
private
:
73
STK_NONCOPYABLE_CLASS
(
ScopedCriticalSection
);
74
75
void
Lock
() {
hw::CriticalSection::Enter
(); }
76
void
Unlock
() {
hw::CriticalSection::Exit
(); }
77
};
78
79
}
// namespace sync
80
}
// namespace stk
81
82
#endif
/* STK_SYNC_CS_H_ */
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::Exit
static void Exit()
Exit a critical section.
Definition
stktest.cpp:78
stk::hw::CriticalSection::Enter
static void Enter()
Enter a critical section.
Definition
stktest.cpp:74
stk::IMutex
Interface for mutex synchronization primitive.
Definition
stk_common.h:381
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:65
stk::sync::ScopedCriticalSection::EventFlags
friend class EventFlags
Definition
stk_sync_cs.h:56
stk::sync::ScopedCriticalSection::Unlock
void Unlock()
Unlock the mutex.
Definition
stk_sync_cs.h:76
stk::sync::ScopedCriticalSection::Lock
void Lock()
Lock the mutex.
Definition
stk_sync_cs.h:75
stk::sync::ScopedCriticalSection::Event
friend class Event
Definition
stk_sync_cs.h:55
stk::sync::ScopedCriticalSection::~ScopedCriticalSection
~ScopedCriticalSection()
Exits critical section.
Definition
stk_sync_cs.h:70
stk::sync::ScopedCriticalSection::Pipe
friend class Pipe
Definition
stk_sync_cs.h:60
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::STK_NONCOPYABLE_CLASS
STK_NONCOPYABLE_CLASS(ScopedCriticalSection)
stk
include
sync
stk_sync_cs.h
Generated by
1.15.0