[llvm-bugs] [Bug 49721] New: std::binary_semaphore::try_acquire() blocks forever
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 25 00:33:03 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49721
Bug ID: 49721
Summary: std::binary_semaphore::try_acquire() blocks forever
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: CONFIRMED
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: raul at tambre.ee
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Created attachment 24693
--> https://bugs.llvm.org/attachment.cgi?id=24693&action=edit
repro
[thread.sema.cnt] says for try_acquire():
Effects: Attempts to atomically decrement counter if it is positive, without
blocking. [...]
libc++'s try_acquire() maps to
try_acquire_for(std::chrono::nanoseconds::zero()) which in the case of
std::binary_semaphore boils down to __libcpp_thread_poll_with_backoff(), which
treats a zero timeout as an infinite timeout, resulting in try_acquire()
blocking forever if it's unable to decrement.
The attached .cpp file demonstrates the problem.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210325/06daad2d/attachment.html>
More information about the llvm-bugs
mailing list