Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154796920
D46108.id141328.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
571 B
Referenced Files
None
Subscribers
None
D46108.id141328.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D46108: exit(3): make it thread-safe
Attached
Detach File
Event Timeline
Log In to Comment