[llvm-bugs] [Bug 41396] New: libc++abi should report forced unwinding on thread termination.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 5 09:56:47 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41396

            Bug ID: 41396
           Summary: libc++abi should report forced unwinding on thread
                    termination.
           Product: libc++abi
           Version: 7.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

libstdc++ throws an exception when forced unwinding occurs, for example by a
call to pthread_exit.

This allows the library to detect and avoid certain classes of bugs. For
example, libc++ hangs forever on this test, libstdc++ reports the promise as
broken.

#include <future>
#include <stdexcept>
#include <pthread.h>
#include <cassert>
​
void f() { pthread_exit(nullptr); }
​
int main()
{
 auto fut = std::async(std::launch::async, f);
 try
 {
  fut.get();
  throw std::logic_error("Unreachable");
 }
 catch (const std::future_error& e)
 {
  assert( e.code() == std::future_errc::broken_promise );
 }
}

-- 
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/20190405/ce57c019/attachment.html>


More information about the llvm-bugs mailing list