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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to