summaryrefslogtreecommitdiff
path: root/lib/libc_r/thread
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>2000-01-14 06:16:38 +0000
committerDavid Leonard <d@cvs.openbsd.org>2000-01-14 06:16:38 +0000
commit65f398beff229464c5f88f751c7e4f62f516afc6 (patch)
treec9b4e419a7fb3e4e5d5411582df14a96ff97192a /lib/libc_r/thread
parent3c9f5b1361e54c3fd2d464bbdacd5f6896fadd60 (diff)
malloc lock helpers
Diffstat (limited to 'lib/libc_r/thread')
-rw-r--r--lib/libc_r/thread/thread_malloc_lock.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libc_r/thread/thread_malloc_lock.c b/lib/libc_r/thread/thread_malloc_lock.c
new file mode 100644
index 00000000000..68f899983cb
--- /dev/null
+++ b/lib/libc_r/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);
+}