[libcxx-commits] [libcxx] [libc++] Don't try to wait on a thread that hasn't started in std::async (PR #125433)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 19 08:13:27 PST 2025
================
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads, no-exceptions
+
+// UNSUPPORTED: c++03
+
+// There is no way to limit the number of threads on windows
+// UNSUPPORTED: msvc
+
+// AIX doesn't seem to complain if the thread limit is reached.
+// XFAIL: target={{.+}}-aix{{.*}}
+
+#include <cassert>
+#include <future>
+#include <system_error>
+
+#if __has_include(<sys/resource.h>)
+# include <sys/resource.h>
+# ifdef RLIMIT_NPROC
+void force_thread_creation_failure() {
+ rlimit lim = {1, 1};
+ setrlimit(RLIMIT_NPROC, &lim);
+}
+# else
+# error "No known way to force only one thread being available"
+# endif
+#else
+# error "No known way to force only one thread being available"
+#endif
+
+int main() {
----------------
ldionne wrote:
```suggestion
int main(int, char**) {
```
https://github.com/llvm/llvm-project/pull/125433
More information about the libcxx-commits
mailing list