Page MenuHomeFreeBSD

D46108.id141328.diff
No OneTemporary

D46108.id141328.diff

diff --git a/lib/libc/stdlib/exit.c b/lib/libc/stdlib/exit.c
--- a/lib/libc/stdlib/exit.c
+++ b/lib/libc/stdlib/exit.c
@@ -48,6 +48,8 @@
*/
int __isthreaded = 0;
+static pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER;
+
/*
* Exit, flushing stdio buffers if necessary.
*/
@@ -59,6 +61,10 @@
_thread_autoinit_dummy_decl = 1;
+ /* Make exit(3) thread-safe */
+ if (__isthreaded)
+ _pthread_mutex_lock(&exit_mutex);
+
/*
* We're dealing with cleaning up thread_local destructors in the case of
* the process termination through main() exit.

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 30, 11:27 AM (17 m, 54 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32504791
Default Alt Text
D46108.id141328.diff (571 B)

Event Timeline