~aleteoryx/muditaos

ref: ef556d43f24756643effcb43ee3866421c08a52d muditaos/module-os/LockGuard.hpp -rw-r--r-- 556 bytes
ef556d43 — Pawel Olejniczak [CP-1423] Update backup and restore endpoint API test 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <mutex.hpp>

class LockGuard
{
public:
    explicit LockGuard(cpp_freertos::MutexStandard& mutex);
    ~LockGuard();
    LockGuard(const LockGuard &) = delete;
    LockGuard(LockGuard &&)      = delete;

    LockGuard &operator=(const LockGuard &) = delete;
    LockGuard &operator=(LockGuard &&) = delete;

private:
    BaseType_t savedInterruptStatus;
    cpp_freertos::MutexStandard &mutex;
};