[all-commits] [llvm/llvm-project] c92a25: [libc++] Fix hang in counting_semaphore::try_acquire

Quuxplusone via All-commits all-commits at lists.llvm.org
Fri Nov 5 13:03:14 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c92a253cf0ddcf905707b4e9265b42570ce409d9
      https://github.com/llvm/llvm-project/commit/c92a253cf0ddcf905707b4e9265b42570ce409d9
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2021-11-05 (Fri, 05 Nov 2021)

  Changed paths:
    M libcxx/include/semaphore
    M libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp

  Log Message:
  -----------
  [libc++] Fix hang in counting_semaphore::try_acquire

Before this patch, `try_acquire` blocks instead of returning false.
This is because `__libcpp_thread_poll_with_backoff` interprets zero
as meaning infinite, causing `try_acquire` to wait indefinitely.

Thanks to Pablo Busse (pabusse) for the patch!

Differential Revision: https://reviews.llvm.org/D98334




More information about the All-commits mailing list