Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
PlatformMutex.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2019 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-public-api */ 00023 /** @{*/ 00024 00025 /** \defgroup platform_PlatformMutex PlatformMutex class 00026 * @{ 00027 */ 00028 00029 /** The PlatformMutex class is used to synchronize the execution of threads. 00030 * 00031 * Mbed drivers use the PlatformMutex class instead of rtos::Mutex. 00032 * This enables the use of drivers when the Mbed OS is compiled without the RTOS. 00033 * 00034 * @note 00035 * - When the RTOS is present, the PlatformMutex becomes a typedef for rtos::Mutex. 00036 * - When the RTOS is absent, all methods are defined as noop. 00037 */ 00038 00039 #ifdef MBED_CONF_RTOS_API_PRESENT 00040 00041 // rtos::Mutex is itself a dummy class if the RTOS API is present, but not the RTOS 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 13:54:41 by
