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: unassignedb...@nondot.org
          Reporter: e...@efcs.ca
                CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to