From f79af607fea8db71524b8a4a1553fb437b284616 Mon Sep 17 00:00:00 2001 From: otto <> Date: Wed, 22 Feb 2006 07:16:32 +0000 Subject: Avouid a race in atexit() handling by introducing a lock. Problem originally reported by Gergely Kovacs; help from dhartmei@; ok tedu@ millert@ --- src/lib/libc/include/thread_private.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/lib/libc/include') diff --git a/src/lib/libc/include/thread_private.h b/src/lib/libc/include/thread_private.h index 9fbadce008..5fbbf592a4 100644 --- a/src/lib/libc/include/thread_private.h +++ b/src/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 */ @@ -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_ */ -- cgit v1.2.3-55-g6feb