From 861d8ed7e7981b0a629aa5919f8643ad71eb52d0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 11 Dec 2015 10:13:20 -0800 Subject: Add tests for thread options --- test/core/support/thd_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index faba33c5e8..f7807d280a 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -62,6 +62,19 @@ static void thd_body(void *v) { static void thd_body_joinable(void *v) {} +/* Test thread options work as expected */ +static void test_options(void) { + gpr_thd_options options = gpr_thd_options_default(); + GPR_ASSERT(!gpr_thd_options_is_joinable(&options)); + GPR_ASSERT(gpr_thd_options_is_detached(&options)); + gpr_thd_options_set_joinable(&options); + GPR_ASSERT(gpr_thd_options_is_joinable(&options)); + GPR_ASSERT(!gpr_thd_options_is_detached(&options)); + gpr_thd_options_set_detached(&options); + GPR_ASSERT(!gpr_thd_options_is_joinable(&options)); + GPR_ASSERT(gpr_thd_options_is_detached(&options)); +} + /* Test that we can create a number of threads and wait for them. */ static void test(void) { int i; @@ -96,6 +109,7 @@ static void test(void) { int main(int argc, char *argv[]) { grpc_test_init(argc, argv); + test_options(); test(); return 0; } -- cgit v1.2.3