diff options
author | otto <> | 2006-02-22 07:16:32 +0000 |
---|---|---|
committer | otto <> | 2006-02-22 07:16:32 +0000 |
commit | f79af607fea8db71524b8a4a1553fb437b284616 (patch) | |
tree | b3ca7c28557a9e6e12c3c78b3442ef8b086ebff1 /src/lib/libc/include | |
parent | ac647c4699103a57b222ea6685c784a0445c0790 (diff) | |
download | openbsd-f79af607fea8db71524b8a4a1553fb437b284616.tar.gz openbsd-f79af607fea8db71524b8a4a1553fb437b284616.tar.bz2 openbsd-f79af607fea8db71524b8a4a1553fb437b284616.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 'src/lib/libc/include')
-rw-r--r-- | src/lib/libc/include/thread_private.h | 13 |
1 files changed, 12 insertions, 1 deletions
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 @@ | |||
1 | /* $OpenBSD: thread_private.h,v 1.17 2005/11/15 11:56:40 millert Exp $ */ | 1 | /* $OpenBSD: thread_private.h,v 1.18 2006/02/22 07:16:31 otto Exp $ */ |
2 | 2 | ||
3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ | 3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ |
4 | 4 | ||
@@ -123,5 +123,16 @@ void _thread_malloc_unlock(void); | |||
123 | _thread_malloc_init();\ | 123 | _thread_malloc_init();\ |
124 | } while (0) | 124 | } while (0) |
125 | 125 | ||
126 | void _thread_atexit_lock(void); | ||
127 | void _thread_atexit_unlock(void); | ||
128 | |||
129 | #define _ATEXIT_LOCK() do { \ | ||
130 | if (__isthreaded) \ | ||
131 | _thread_atexit_lock(); \ | ||
132 | } while (0) | ||
133 | #define _ATEXIT_UNLOCK() do { \ | ||
134 | if (__isthreaded) \ | ||
135 | _thread_atexit_unlock();\ | ||
136 | } while (0) | ||
126 | 137 | ||
127 | #endif /* _THREAD_PRIVATE_H_ */ | 138 | #endif /* _THREAD_PRIVATE_H_ */ |