diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2025-01-08 21:47:58 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-08 21:47:58 -0800 |
| commit | b30f9d74d6a0f735ef597b1acae73daac2d7df39 (patch) | |
| tree | ede0212248bfcea9add52a5d791f537f13ff80a2 /libc/src/__support/threads/thread.cpp | |
| parent | 459d413b74b7f41e820328fefc38ff93b2e42b00 (diff) | |
[libc] Fix return value of __cxa_thread_atexit_impl function. (#122171)
This has been added in 0071a79532e8d664b734956a431d8c8c942cc25e 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).
Diffstat (limited to 'libc/src/__support/threads/thread.cpp')
| -rw-r--r-- | libc/src/__support/threads/thread.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/src/__support/threads/thread.cpp b/libc/src/__support/threads/thread.cpp index dad4f75f092e..6f6b75be5766 100644 --- a/libc/src/__support/threads/thread.cpp +++ b/libc/src/__support/threads/thread.cpp @@ -117,7 +117,9 @@ public: int add_callback(AtExitCallback *callback, void *obj) { cpp::lock_guard lock(mtx); - return callback_list.push_back({callback, obj}); + if (callback_list.push_back({callback, obj})) + return 0; + return -1; } void call() { |
