diff options
author | 2015-12-11 10:13:20 -0800 | |
---|---|---|
committer | 2015-12-11 10:13:20 -0800 | |
commit | 861d8ed7e7981b0a629aa5919f8643ad71eb52d0 (patch) | |
tree | 36044638ad3fe82ddf83bc242deec6d899bd5f65 /test/core/support | |
parent | aa1ebffb323e012167d080c8375097e1bd290fc4 (diff) |
Add tests for thread options
Diffstat (limited to 'test/core/support')
-rw-r--r-- | test/core/support/thd_test.c | 14 |
1 files changed, 14 insertions, 0 deletions
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; } |