[libc-commits] [libc] 89aa4bd - [libc] Unlock after pop_back

Alex Brachet via libc-commits libc-commits at lists.llvm.org
Tue Mar 15 21:00:41 PDT 2022


Author: Alex Brachet
Date: 2022-03-16T04:00:26Z
New Revision: 89aa4bd3fbd5f5091f4011f56adde59f90ea0f28

URL: https://github.com/llvm/llvm-project/commit/89aa4bd3fbd5f5091f4011f56adde59f90ea0f28
DIFF: https://github.com/llvm/llvm-project/commit/89aa4bd3fbd5f5091f4011f56adde59f90ea0f28.diff

LOG: [libc] Unlock after pop_back

Added: 
    

Modified: 
    libc/src/stdlib/atexit.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/stdlib/atexit.cpp b/libc/src/stdlib/atexit.cpp
index e1746aa4d96bf..f38702c6cfcf9 100644
--- a/libc/src/stdlib/atexit.cpp
+++ b/libc/src/stdlib/atexit.cpp
@@ -28,9 +28,9 @@ namespace internal {
 void call_exit_callbacks() {
   handler_list_mtx.lock();
   while (!exit_callbacks.empty()) {
-    handler_list_mtx.unlock();
     auto *callback = exit_callbacks.back();
     exit_callbacks.pop_back();
+    handler_list_mtx.unlock();
     callback();
     handler_list_mtx.lock();
   }


        


More information about the libc-commits mailing list