The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
Diff: platform/SingletonPtr.h
- Revision:
- 171:3a7713b1edbc
- Parent:
- 170:e95d10626187
- Child:
- 172:65be27845400
--- a/platform/SingletonPtr.h Thu Sep 06 13:39:34 2018 +0100 +++ b/platform/SingletonPtr.h Thu Nov 08 11:45:42 2018 +0000 @@ -43,6 +43,10 @@ inline static void singleton_lock(void) { #ifdef MBED_CONF_RTOS_PRESENT + if (!singleton_mutex_id) { + // RTOS has not booted yet so no mutex is needed + return; + } osMutexAcquire(singleton_mutex_id, osWaitForever); #endif } @@ -56,6 +60,10 @@ inline static void singleton_unlock(void) { #ifdef MBED_CONF_RTOS_PRESENT + if (!singleton_mutex_id) { + // RTOS has not booted yet so no mutex is needed + return; + } osMutexRelease(singleton_mutex_id); #endif }