From 6222a7a000f4cb49656bc27f0f46889c13e4cba5 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 13 Sep 2022 18:20:57 +0200 Subject: [PATCH] vcomp/tests: Limit the number of nested threads. Without a limit we'd create nb_cpus ^ 2 threads. --- dlls/vcomp/tests/vcomp.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c index 639291a1772..67000e9f343 100644 --- a/dlls/vcomp/tests/vcomp.c +++ b/dlls/vcomp/tests/vcomp.c @@ -406,6 +406,10 @@ static void CDECL num_threads_cb(BOOL nested, int parallel, int nested_threads, is_parallel = pomp_in_parallel(); ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel); + /* limit number of nested threads */ + nested_threads = min( nested_threads, 256 / pomp_get_max_threads() ); + p_vcomp_set_num_threads(nested_threads); + thread_count = 0; p_vcomp_fork(TRUE, 2, num_threads_cb2, TRUE, &thread_count); if (nested) @@ -422,17 +426,6 @@ static void CDECL num_threads_cb(BOOL nested, int parallel, int nested_threads, is_parallel = pomp_in_parallel(); ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel); - - p_vcomp_set_num_threads(4); - thread_count = 0; - p_vcomp_fork(TRUE, 2, num_threads_cb2, TRUE, &thread_count); - if (nested) - ok(thread_count == 4, "expected 4 threads, got %ld\n", thread_count); - else - ok(thread_count == 1, "expected 1 thread, got %ld\n", thread_count); - - is_parallel = pomp_in_parallel(); - ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel); } static void test_omp_get_num_threads(BOOL nested)