From cc43d693e5c715fcbdab1717efc4c84ef836a1fb Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Mon, 14 Mar 2016 15:53:30 -0700 Subject: [PATCH 1/3] Reduce the number of threads so that this test works on x86 systems --- test/core/support/thd_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index f7807d280a2..2671dd3d3d5 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -79,9 +79,9 @@ static void test_options(void) { static void test(void) { int i; gpr_thd_id thd; - gpr_thd_id thds[1000]; + gpr_thd_id thds[300]; struct test t; - int n = 1000; + int n = 300; gpr_thd_options options = gpr_thd_options_default(); gpr_mu_init(&t.mu); gpr_cv_init(&t.done_cv); From b19489c6c8ae7d3da0bb3830eef0ad91ddcfe506 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Mon, 14 Mar 2016 16:12:14 -0700 Subject: [PATCH 2/3] Minor code cleanup --- test/core/support/thd_test.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index 2671dd3d3d5..4b5e41eac78 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -41,6 +41,8 @@ #include #include "test/core/util/test_config.h" +#define NUM_THREADS 300 + struct test { gpr_mu mu; int n; @@ -79,15 +81,14 @@ static void test_options(void) { static void test(void) { int i; gpr_thd_id thd; - gpr_thd_id thds[300]; + gpr_thd_id thds[NUM_THREADS]; struct test t; - int n = 300; gpr_thd_options options = gpr_thd_options_default(); gpr_mu_init(&t.mu); gpr_cv_init(&t.done_cv); - t.n = n; + t.n = NUM_THREADS; t.is_done = 0; - for (i = 0; i != n; i++) { + for (i = 0; i < NUM_THREADS; i++) { GPR_ASSERT(gpr_thd_new(&thd, &thd_body, &t, NULL)); } gpr_mu_lock(&t.mu); @@ -97,10 +98,10 @@ static void test(void) { gpr_mu_unlock(&t.mu); GPR_ASSERT(t.n == 0); gpr_thd_options_set_joinable(&options); - for (i = 0; i < n; i++) { + for (i = 0; i < NUM_THREADS; i++) { GPR_ASSERT(gpr_thd_new(&thds[i], &thd_body_joinable, NULL, &options)); } - for (i = 0; i < n; i++) { + for (i = 0; i < NUM_THREADS; i++) { gpr_thd_join(thds[i]); } } From f7cea976581a19a06eca5d54089920ead4f788ae Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Mon, 14 Mar 2016 17:01:15 -0700 Subject: [PATCH 3/3] Fix copyright --- test/core/support/thd_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index 4b5e41eac78..0c176da2d3c 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without