~aleteoryx/muditaos

ref: 082966f9aff05b48009499a1d9b6290b497d5a82 muditaos/module-os/LockGuard.hpp -rw-r--r-- 556 bytes
082966f9 — Pawel Olejniczak [MOS-36] Disallow going to normal contact list after emergency call 4 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;
};