From 65f398beff229464c5f88f751c7e4f62f516afc6 Mon Sep 17 00:00:00 2001 From: David Leonard Date: Fri, 14 Jan 2000 06:16:38 +0000 Subject: malloc lock helpers --- lib/libc/thread/unithread_malloc_lock.c | 21 +++++++++++++++++++++ lib/libc_r/thread/thread_malloc_lock.c | 18 ++++++++++++++++++ lib/libpthread/thread/thread_malloc_lock.c | 18 ++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 lib/libc/thread/unithread_malloc_lock.c create mode 100644 lib/libc_r/thread/thread_malloc_lock.c create mode 100644 lib/libpthread/thread/thread_malloc_lock.c (limited to 'lib') 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 +#include +#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 +#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 +#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); +} -- cgit v1.2.3