Skip to content

Commit b30f9d7

Browse files
authored
[libc] Fix return value of __cxa_thread_atexit_impl function. (#122171)
This has been added in 0071a79 to support TLS destructors. Return value of __cxa_thread_atexit is supposed to be the same as std::atexit - zero on success, non-zero on failure. Update the code to do just that (also be consistent with llvm-libc's existing atexit / at_quick_exit implementations).
1 parent 459d413 commit b30f9d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libc/src/__support/threads/thread.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ class ThreadAtExitCallbackMgr {
117117

118118
int add_callback(AtExitCallback *callback, void *obj) {
119119
cpp::lock_guard lock(mtx);
120-
return callback_list.push_back({callback, obj});
120+
if (callback_list.push_back({callback, obj}))
121+
return 0;
122+
return -1;
121123
}
122124

123125
void call() {

0 commit comments

Comments
 (0)