mn_critical.hpp File Reference
#include "mn_config.hpp"
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include "mn_error.hpp"
#include "mn_micros.hpp"
#include "mn_autolock.hpp"
#include "slock/mn_criticalsection.hpp"
#include "slock/mn_interrupts_lock.hpp"
#include "slock/mn_schedular_lock.hpp"

Go to the source code of this file.

Namespaces

 mn
 
 mn::system
 

Macros

#define CRITICAL_SECTION(OBJECT)   if( (bool)(auto_critical_t lock(OBJECT)) )
 
#define CRITICAL_SECTION_TIMEDOUT(OBJECT)   if( (bool)(auto_critical_section_timedout_t lock(OBJECT)) )
 
#define CRITICAL_SECTION_NESTED(OBJECT)   if( (bool)(auto_critical_section_nested_t lock(OBJECT)) )
 
#define INTERRUPTS_LOCK(OBJECT)   if( (bool)(auto_interrupts_lock_t lock(OBJECT)) )
 
#define SCHEDULAR_LOCK(OBJECT)   if( (bool)(auto_schedular_lock_t lock(OBJECT)) )
 

Typedefs

using mn::system::critical_section_t = basic_critical_section
 
using mn::system::critical_section_timedout_t = basic_critical_section_timedout
 
using mn::system::critical_section_nested_t = basic_critical_section_nested
 
using mn::system::interrupts_lock_t = basic_interrupts_lock
 
using mn::system::schedular_lock_t = basic_schedular_lock
 
using mn::system::auto_critical_section_t = basic_autolock< basic_critical_section >
 
using mn::system::auto_critical_section_timedout_t = basic_autolock< critical_section_timedout_t >
 
using mn::system::auto_critical_section_nested_t = basic_autolock< critical_section_nested_t >
 
using mn::system::auto_interrupts_lock_t = basic_autolock< interrupts_lock_t >
 
using mn::system::auto_schedular_lock_t = basic_autolock< schedular_lock_t >
 

Detailed Description

This file is part of the Mini Thread Library (https://github.com/RoseLeBlood/MiniThread ).

Author
Copyright (c) 2018 Amber-Sophia Schroeck
License
The Mini Thread Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3, or (at your option) any later version.

The Mini Thread Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Mini Thread Library; if not, see https://www.gnu.org/licenses/.

Macro Definition Documentation

◆ CRITICAL_SECTION

#define CRITICAL_SECTION (   OBJECT)    if( (bool)(auto_critical_t lock(OBJECT)) )
void function() {
critical_section_t critical_section;
CRITICAL_SECTION(critical_section) {
// locked section code goes hier
}
// unlocked section code goes hier
}
#define CRITICAL_SECTION(OBJECT)
Definition: mn_critical.hpp:49
basic_critical_section critical_section_t
Definition: mn_critical.hpp:104

◆ CRITICAL_SECTION_NESTED

#define CRITICAL_SECTION_NESTED (   OBJECT)    if( (bool)(auto_critical_section_nested_t lock(OBJECT)) )
void function() {
critical_section_nested_t critical_section;
CRITICAL_SECTION_NESTED(critical_section) {
// locked section code goes hier
}
// unlocked section code goes hier
}
#define CRITICAL_SECTION_NESTED(OBJECT)
Definition: mn_critical.hpp:74
basic_critical_section_nested critical_section_nested_t
Definition: mn_critical.hpp:108

◆ CRITICAL_SECTION_TIMEDOUT

#define CRITICAL_SECTION_TIMEDOUT (   OBJECT)    if( (bool)(auto_critical_section_timedout_t lock(OBJECT)) )
void function() {
critical_section_timedout_t critical_section;
CRITICAL_SECTION_TIMEDOUT(critical_section) {
// locked section code goes hier
}
// unlocked section code goes hier
}
#define CRITICAL_SECTION_TIMEDOUT(OBJECT)
Definition: mn_critical.hpp:62
basic_critical_section_timedout critical_section_timedout_t
Definition: mn_critical.hpp:106

◆ INTERRUPTS_LOCK

#define INTERRUPTS_LOCK (   OBJECT)    if( (bool)(auto_interrupts_lock_t lock(OBJECT)) )
void function() {
interrupts_lock_t interrupts_lock;
INTERRUPTS_LOCK(interrupts_lock) {
// locked section code goes hier
}
// unlocked section code goes hier
}
#define INTERRUPTS_LOCK(OBJECT)
Definition: mn_critical.hpp:88
basic_interrupts_lock interrupts_lock_t
Definition: mn_critical.hpp:111

◆ SCHEDULAR_LOCK

#define SCHEDULAR_LOCK (   OBJECT)    if( (bool)(auto_schedular_lock_t lock(OBJECT)) )
void function() {
schedular_lock_t schedlock;
SCHEDULAR_LOCK(schedlock) {
// locked section code goes hier
}
// unlocked section code goes hier
}
#define SCHEDULAR_LOCK(OBJECT)
Definition: mn_critical.hpp:101
basic_schedular_lock schedular_lock_t
Definition: mn_critical.hpp:114