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: HelloWorld_CCA01M1 HelloWorld_CCA02M1 CI-data-logger-server HelloWorld_CCA02M1 ... more
This is a fork of the events subdirectory of https://github.com/ARMmbed/mbed-os.
Note, you must import this library with import name: events!!!
Diff: hal/common/retarget.cpp
- Revision:
- 6984:94fc5d678e5f
- Parent:
- 6939:3866e967d1f2
- Child:
- 7328:33c1e9a22f71
- Child:
- 7262:f469aee29594
--- a/hal/common/retarget.cpp Tue Jul 12 17:34:29 2016 -0500
+++ b/hal/common/retarget.cpp Mon Jun 27 18:55:07 2016 -0500
@@ -21,6 +21,7 @@
#include "toolchain.h"
#include "semihost_api.h"
#include "mbed_interface.h"
+#include "SingletonPtr.h"
#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif
@@ -72,17 +73,17 @@
* (or rather index+3, as filehandles 0-2 are stdin/out/err).
*/
static FileHandle *filehandles[OPEN_MAX];
-static PlatformMutex filehandle_mutex;
+static SingletonPtr<PlatformMutex> filehandle_mutex;
FileHandle::~FileHandle() {
- filehandle_mutex.lock();
+ filehandle_mutex->lock();
/* Remove all open filehandles for this */
for (unsigned int fh_i = 0; fh_i < sizeof(filehandles)/sizeof(*filehandles); fh_i++) {
if (filehandles[fh_i] == this) {
filehandles[fh_i] = NULL;
}
}
- filehandle_mutex.unlock();
+ filehandle_mutex->unlock();
}
#if DEVICE_SERIAL
@@ -162,17 +163,17 @@
#endif
// find the first empty slot in filehandles
- filehandle_mutex.lock();
+ filehandle_mutex->lock();
unsigned int fh_i;
for (fh_i = 0; fh_i < sizeof(filehandles)/sizeof(*filehandles); fh_i++) {
if (filehandles[fh_i] == NULL) break;
}
if (fh_i >= sizeof(filehandles)/sizeof(*filehandles)) {
- filehandle_mutex.unlock();
+ filehandle_mutex->unlock();
return -1;
}
filehandles[fh_i] = (FileHandle*)FILE_HANDLE_RESERVED;
- filehandle_mutex.unlock();
+ filehandle_mutex->unlock();
FileHandle *res;