summaryrefslogtreecommitdiff
path: root/components/cplusplus/Lock.h
blob: 08d57c4850a909e45a8a2a3486800b78c689e471 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2016/10/1      Bernard      The first version
 */

#pragma once

#include <stdint.h>
#include <string.h>

namespace rtthread {

class Lock
{
public:
    Lock(Mutex& mutex) : m(mutex) {m.lock();}
    ~Lock() {m.unlock();}

protected:
    Mutex &m;
};

}