summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thread_malloc_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/thread/thread_malloc_lock.c')
-rw-r--r--lib/libpthread/thread/thread_malloc_lock.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thread_malloc_lock.c b/lib/libpthread/thread/thread_malloc_lock.c
new file mode 100644
index 00000000000..68f899983cb
--- /dev/null
+++ b/lib/libpthread/thread/thread_malloc_lock.c
@@ -0,0 +1,18 @@
+#include <pthread.h>
+#include "pthread_private.h"
+#include "thread_private.h"
+#include "spinlock.h"
+
+static spinlock_t malloc_lock = _SPINLOCK_INITIALIZER;
+
+void
+_thread_malloc_lock()
+{
+ _SPINLOCK(&malloc_lock);
+}
+
+void
+_thread_malloc_unlock()
+{
+ _SPINUNLOCK(&malloc_lock);
+}