xref: /nrf52832-nimble/rt-thread/components/cplusplus/Lock.h (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2016/10/1      Bernard      The first version
9  */
10 
11 #pragma once
12 
13 #include <stdint.h>
14 #include <string.h>
15 
16 namespace rtthread {
17 
18 class Lock
19 {
20 public:
Lock(Mutex & mutex)21     Lock(Mutex& mutex) : m(mutex) {m.lock();}
~Lock()22     ~Lock() {m.unlock();}
23 
24 protected:
25     Mutex &m;
26 };
27 
28 }
29