[libc-commits] [libc] [libc] fix EAGAIN being treated as timeout in mutex and rwlock (PR #203574)

via libc-commits libc-commits at lists.llvm.org
Fri Jun 12 09:18:58 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- libc/src/__support/threads/linux/futex_utils.h libc/src/__support/threads/raw_mutex.h libc/src/__support/threads/raw_rwlock.h libc/test/integration/src/__support/threads/futex_requeue_test.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/__support/threads/raw_rwlock.h b/libc/src/__support/threads/raw_rwlock.h
index c0140b213..b08d8e4c0 100644
--- a/libc/src/__support/threads/raw_rwlock.h
+++ b/libc/src/__support/threads/raw_rwlock.h
@@ -400,7 +400,8 @@ private:
       // reached.
       bool timeout_flag = false;
       if (!old.can_acquire<role>(get_preference())) {
-        ErrorOr<int> wait_result = queue.wait<role>(serial_number, timeout, is_pshared);
+        ErrorOr<int> wait_result =
+            queue.wait<role>(serial_number, timeout, is_pshared);
         timeout_flag =
             (!wait_result.has_value() && wait_result.error() == ETIMEDOUT);
       }

``````````

</details>


https://github.com/llvm/llvm-project/pull/203574


More information about the libc-commits mailing list