[libcxx-commits] [libcxx] [libc++][AIX] Fix force_thread_creation_failure by using RLIMIT_THREADS (PR #188787)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 26 09:57:04 PDT 2026
https://github.com/Himadhith updated https://github.com/llvm/llvm-project/pull/188787
>From 33a2d89008ba12472f9ebd52ca6fe4ba0079e32f Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Thu, 26 Mar 2026 14:01:12 -0400
Subject: [PATCH 1/2] [libc++][AIX] Fix force_thread_creation_failure by using
RLIMIT_THREADS
---
.../futures/futures.async/thread_create_failure.pass.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp b/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp
index 70009589e985b..ebc121984d061 100644
--- a/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp
@@ -17,7 +17,7 @@
// UNSUPPORTED: windows
// AIX, macOS and FreeBSD seem to limit the number of processes, not threads via RLIMIT_NPROC
-// XFAIL: target={{.+}}-aix{{.*}}
+// But there is RLIMIT_THREADS in AIX which can be used here to limit the threads.
// XFAIL: target={{.+}}-apple-{{.*}}
// XFAIL: freebsd
@@ -33,7 +33,12 @@
#if __has_include(<sys/resource.h>)
# include <sys/resource.h>
-# ifdef RLIMIT_NPROC
+# if defined(_AIX) && defined(RLIMIT_THREADS)
+void force_thread_creation_failure() {
+ rlimit lim = {1, 1};
+ assert(setrlimit(RLIMIT_THREADS, &lim) == 0);
+}
+# elif RLIMIT_NPROC
void force_thread_creation_failure() {
rlimit lim = {1, 1};
assert(setrlimit(RLIMIT_NPROC, &lim) == 0);
>From 938e09a5b3283cd30fa0bbc1f1ae81abef6e19e6 Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Thu, 26 Mar 2026 14:39:02 -0400
Subject: [PATCH 2/2] Adding defined to RLIMIT_NPROC
---
.../thread/futures/futures.async/thread_create_failure.pass.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp b/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp
index ebc121984d061..91b15e9361c20 100644
--- a/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.async/thread_create_failure.pass.cpp
@@ -38,7 +38,7 @@ void force_thread_creation_failure() {
rlimit lim = {1, 1};
assert(setrlimit(RLIMIT_THREADS, &lim) == 0);
}
-# elif RLIMIT_NPROC
+# elif defined(RLIMIT_NPROC)
void force_thread_creation_failure() {
rlimit lim = {1, 1};
assert(setrlimit(RLIMIT_NPROC, &lim) == 0);
More information about the libcxx-commits
mailing list