summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authord <d@openbsd.org>2000-01-14 06:16:37 +0000
committerd <d@openbsd.org>2000-01-14 06:16:37 +0000
commit6dea8d7e77a708c4c92189a398f3ed854922cce7 (patch)
tree3982dcc9f39f3c33c32a1f79c863a9536baf8abf
parenttypo; rogoyski@cs.utexas.edu (diff)
downloadwireguard-openbsd-6dea8d7e77a708c4c92189a398f3ed854922cce7.tar.xz
wireguard-openbsd-6dea8d7e77a708c4c92189a398f3ed854922cce7.zip
malloc lock helpers
-rw-r--r--lib/libc/thread/unithread_malloc_lock.c21
-rw-r--r--lib/libc_r/thread/thread_malloc_lock.c18
-rw-r--r--lib/libpthread/thread/thread_malloc_lock.c18
3 files changed, 57 insertions, 0 deletions
diff --git a/lib/libc/thread/unithread_malloc_lock.c b/lib/libc/thread/unithread_malloc_lock.c
new file mode 100644
index 00000000000..67e51559180
--- /dev/null
+++ b/lib/libc/thread/unithread_malloc_lock.c
@@ -0,0 +1,21 @@
+/* $OpenBSD: unithread_malloc_lock.c,v 1.1 2000/01/14 06:16:37 d Exp $ */
+
+#include <sys/cdefs.h>
+#include <pthread.h>
+#include "thread_private.h"
+
+WEAK_PROTOTYPE(_thread_malloc_lock);
+WEAK_PROTOTYPE(_thread_malloc_unlock);
+
+WEAK_ALIAS(_thread_malloc_lock);
+WEAK_ALIAS(_thread_malloc_unlock);
+
+void
+WEAK_NAME(_thread_malloc_lock)()
+{
+}
+
+void
+WEAK_NAME(_thread_malloc_unlock)()
+{
+}
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);
+}
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);
+}