diff options
| author | bernard <[email protected]> | 2017-01-31 13:19:18 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2017-01-31 13:19:18 +0800 |
| commit | eb2c0981974ef5d93e6315880973c4c256c89dc3 (patch) | |
| tree | 5bbb6c36337408262240ef9021d2bd12719e346d /components/cplusplus/Lock.h | |
| parent | 6b183461994ca25f4ea1a8fc78c67320b3fc9481 (diff) | |
[C++] Add C++ interface for RT-Thread kernel.
Diffstat (limited to 'components/cplusplus/Lock.h')
| -rw-r--r-- | components/cplusplus/Lock.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/components/cplusplus/Lock.h b/components/cplusplus/Lock.h new file mode 100644 index 0000000000..2d8cbe5895 --- /dev/null +++ b/components/cplusplus/Lock.h @@ -0,0 +1,42 @@ +/* + * File : Lock.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2016, RT-Thread Development Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * 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; +}; + +} |
