RTC auf true

Committer:
kevman
Date:
Wed Nov 28 15:10:15 2018 +0000
Revision:
0:38ceb79fef03
RTC modified

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kevman 0:38ceb79fef03 1 /*
kevman 0:38ceb79fef03 2 * Copyright (c) 2017, Arm Limited and affiliates.
kevman 0:38ceb79fef03 3 * SPDX-License-Identifier: Apache-2.0
kevman 0:38ceb79fef03 4 *
kevman 0:38ceb79fef03 5 * Licensed under the Apache License, Version 2.0 (the "License");
kevman 0:38ceb79fef03 6 * you may not use this file except in compliance with the License.
kevman 0:38ceb79fef03 7 * You may obtain a copy of the License at
kevman 0:38ceb79fef03 8 *
kevman 0:38ceb79fef03 9 * http://www.apache.org/licenses/LICENSE-2.0
kevman 0:38ceb79fef03 10 *
kevman 0:38ceb79fef03 11 * Unless required by applicable law or agreed to in writing, software
kevman 0:38ceb79fef03 12 * distributed under the License is distributed on an "AS IS" BASIS,
kevman 0:38ceb79fef03 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
kevman 0:38ceb79fef03 14 * See the License for the specific language governing permissions and
kevman 0:38ceb79fef03 15 * limitations under the License.
kevman 0:38ceb79fef03 16 */
kevman 0:38ceb79fef03 17
kevman 0:38ceb79fef03 18 #ifndef NANOSTACK_LOCK_GUARD_H_
kevman 0:38ceb79fef03 19 #define NANOSTACK_LOCK_GUARD_H_
kevman 0:38ceb79fef03 20
kevman 0:38ceb79fef03 21 #include "eventOS_scheduler.h"
kevman 0:38ceb79fef03 22
kevman 0:38ceb79fef03 23 /**
kevman 0:38ceb79fef03 24 * RAII style Nanostack mutex acquisition.
kevman 0:38ceb79fef03 25 * Mutex is held until object leaves scope.
kevman 0:38ceb79fef03 26 */
kevman 0:38ceb79fef03 27
kevman 0:38ceb79fef03 28 class NanostackLockGuard {
kevman 0:38ceb79fef03 29 public:
kevman 0:38ceb79fef03 30 NanostackLockGuard() {
kevman 0:38ceb79fef03 31 eventOS_scheduler_mutex_wait();
kevman 0:38ceb79fef03 32 }
kevman 0:38ceb79fef03 33
kevman 0:38ceb79fef03 34 ~NanostackLockGuard() {
kevman 0:38ceb79fef03 35 eventOS_scheduler_mutex_release();
kevman 0:38ceb79fef03 36 }
kevman 0:38ceb79fef03 37
kevman 0:38ceb79fef03 38 private:
kevman 0:38ceb79fef03 39 NanostackLockGuard(const NanostackLockGuard&);
kevman 0:38ceb79fef03 40 NanostackLockGuard& operator=(const NanostackLockGuard&);
kevman 0:38ceb79fef03 41 };
kevman 0:38ceb79fef03 42
kevman 0:38ceb79fef03 43 #endif /* NANOSTACK_LOCK_GUARD_H_ */