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: SingletonPtr.h
- Revision:
- 125:2e9cc70d1897
- Parent:
- 123:b0220dba8be7
--- a/SingletonPtr.h Fri Aug 19 10:17:11 2016 +0100 +++ b/SingletonPtr.h Wed Aug 31 18:09:46 2016 +0100 @@ -76,7 +76,9 @@ T* get() { if (NULL == _ptr) { singleton_lock(); - _ptr = new (_data) T; + if (NULL == _ptr) { + _ptr = new (_data) T(); + } singleton_unlock(); } // _ptr was not zero initialized or was