summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/quick_exit.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2017-11-04 10:52:58 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2017-11-04 10:52:58 +0000
commit6a96a39c77491f7dd40eb42db04475616a562779 (patch)
tree552af760b0d015c106cf78521485ee319f9a9689 /lib/libc/stdlib/quick_exit.c
parent5b9a3721e6eacf404b59424db734c63f12177d8d (diff)
Notes
Diffstat (limited to 'lib/libc/stdlib/quick_exit.c')
-rw-r--r--lib/libc/stdlib/quick_exit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/stdlib/quick_exit.c b/lib/libc/stdlib/quick_exit.c
index ef8cdb1b401a..4d81a35f5375 100644
--- a/lib/libc/stdlib/quick_exit.c
+++ b/lib/libc/stdlib/quick_exit.c
@@ -26,6 +26,8 @@
* $FreeBSD$
*/
+#include <sys/types.h>
+#include <machine/atomic.h>
#include <stdlib.h>
#include <pthread.h>
@@ -60,6 +62,7 @@ at_quick_exit(void (*func)(void))
h->cleanup = func;
pthread_mutex_lock(&atexit_mutex);
h->next = handlers;
+ __compiler_membar();
handlers = h;
pthread_mutex_unlock(&atexit_mutex);
return (0);
@@ -74,7 +77,9 @@ quick_exit(int status)
* XXX: The C++ spec requires us to call std::terminate if there is an
* exception here.
*/
- for (h = handlers; NULL != h; h = h->next)
+ for (h = handlers; NULL != h; h = h->next) {
+ __compiler_membar();
h->cleanup();
+ }
_Exit(status);
}