mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
PlatformMutex.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef PLATFORM_MUTEX_H 00018 #define PLATFORM_MUTEX_H 00019 00020 #include "platform/NonCopyable.h" 00021 00022 /** \addtogroup platform 00023 * @{ 00024 */ 00025 00026 /** \defgroup platform_PlatformMutex PlatformMutex class 00027 * @{ 00028 */ 00029 00030 /** The PlatformMutex class is used to synchronize the execution of threads. 00031 * 00032 * Mbed drivers use the PlatformMutex class instead of rtos::Mutex. 00033 * This enables the use of drivers when the Mbed OS is compiled without the RTOS. 00034 * 00035 * @note 00036 * - When the RTOS is present, the PlatformMutex becomes a typedef for rtos::Mutex. 00037 * - When the RTOS is absent, all methods are defined as noop. 00038 */ 00039 00040 #ifdef MBED_CONF_RTOS_PRESENT 00041 00042 #include "rtos/Mutex.h" 00043 typedef rtos::Mutex PlatformMutex; 00044 00045 #else 00046 00047 class PlatformMutex: private mbed::NonCopyable<PlatformMutex> { 00048 public: 00049 /** Create a PlatformMutex object. 00050 * 00051 * @note When the RTOS is present, this is an alias for rtos::Mutex::Mutex(). 00052 */ 00053 PlatformMutex() 00054 { 00055 } 00056 00057 /** PlatformMutex destructor. 00058 * 00059 * @note When the RTOS is present, this is an alias for rtos::Mutex::~Mutex(). 00060 */ 00061 ~PlatformMutex() 00062 { 00063 } 00064 00065 /** Wait until a PlatformMutex becomes available. 00066 * 00067 * @note 00068 * - When the RTOS is present, this is an alias for rtos::Mutex::lock(). 00069 * - When the RTOS is absent, this is a noop. 00070 */ 00071 void lock() 00072 { 00073 } 00074 00075 /** Unlock a PlatformMutex that the same thread has previously locked. 00076 * 00077 * @note 00078 * - When the RTOS is present, this is an alias for rtos::Mutex::unlock(). 00079 * - When the RTOS is absent, this is a noop. 00080 */ 00081 void unlock() 00082 { 00083 } 00084 }; 00085 00086 #endif 00087 00088 #endif 00089 00090 /**@}*/ 00091 00092 /**@}*/
Generated on Tue Jul 12 2022 20:41:15 by 1.7.2