summaryrefslogtreecommitdiffstats
path: root/lib/libc/include
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2006-02-22 07:16:31 +0000
committerotto <otto@openbsd.org>2006-02-22 07:16:31 +0000
commit882a3f0680aa778b013f4c220223d00b28019a86 (patch)
tree0862b8b2a97ace2964bdca1d67de26262731407e /lib/libc/include
parentExpect PMU_INT_SNDBRT while resetting the adb bus; although this brings the (diff)
downloadwireguard-openbsd-882a3f0680aa778b013f4c220223d00b28019a86.tar.xz
wireguard-openbsd-882a3f0680aa778b013f4c220223d00b28019a86.zip
Avouid a race in atexit() handling by introducing a lock. Problem
originally reported by Gergely Kovacs; help from dhartmei@; ok tedu@ millert@
Diffstat (limited to 'lib/libc/include')
-rw-r--r--lib/libc/include/thread_private.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/libc/include/thread_private.h b/lib/libc/include/thread_private.h
index 9fbadce008e..5fbbf592a41 100644
--- a/lib/libc/include/thread_private.h
+++ b/lib/libc/include/thread_private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: thread_private.h,v 1.17 2005/11/15 11:56:40 millert Exp $ */
+/* $OpenBSD: thread_private.h,v 1.18 2006/02/22 07:16:31 otto Exp $ */
/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */
@@ -123,5 +123,16 @@ void _thread_malloc_unlock(void);
_thread_malloc_init();\
} while (0)
+void _thread_atexit_lock(void);
+void _thread_atexit_unlock(void);
+
+#define _ATEXIT_LOCK() do { \
+ if (__isthreaded) \
+ _thread_atexit_lock(); \
+ } while (0)
+#define _ATEXIT_UNLOCK() do { \
+ if (__isthreaded) \
+ _thread_atexit_unlock();\
+ } while (0)
#endif /* _THREAD_PRIVATE_H_ */