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

            Bug ID: 38181
           Summary: std::future does not acquire lock in
                    __has_future_attached
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: mattv...@google.com
                CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com

std::future does not acquire lock in __has_future_attached, which causes a data
race that can be repro'd with the following test case. Compile with
-fsanitize=thread to see the TSAN warnings.


#include <future>
#include <gtest/gtest.h> // googletest header file

namespace {

int DoNothingButReturn()  {
  return 42;
}

TEST(FutureTest, SomeTest) {
  std::async(std::launch::async, DoNothingButReturn);
}

}  // namespace

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to