summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/quick_exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/quick_exit.c')
-rw-r--r--newlib/libc/stdlib/quick_exit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/quick_exit.c b/newlib/libc/stdlib/quick_exit.c
index aaa5f9f7f..5ab2609bf 100644
--- a/newlib/libc/stdlib/quick_exit.c
+++ b/newlib/libc/stdlib/quick_exit.c
@@ -44,7 +44,9 @@ struct quick_exit_handler {
/**
* Lock protecting the handlers list.
*/
+#ifndef __SINGLE_THREAD__
__LOCK_INIT(static, __at_quick_exit_mutex);
+#endif
/**
* Stack of cleanup handlers. These will be invoked in reverse order when
*/
@@ -60,10 +62,14 @@ at_quick_exit(void (*func)(void))
if (NULL == h)
return (1);
h->cleanup = func;
+#ifndef __SINGLE_THREAD__
__lock_acquire(__at_quick_exit_mutex);
+#endif
h->next = handlers;
handlers = h;
+#ifndef __SINGLE_THREAD__
__lock_release(__at_quick_exit_mutex);
+#endif
return (0);
}