aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/support
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-12-11 13:39:53 -0800
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-12-11 13:39:53 -0800
commit5028de775f020ab48d5e3a02a137f6b9a8ace13c (patch)
tree2a1968aa4574fc4e54479e6fe7ebae30ca6d3e31 /test/core/support
parent0aac65ddda9153c3940f9fbb3f63e57524c99a2a (diff)
parent861d8ed7e7981b0a629aa5919f8643ad71eb52d0 (diff)
Merge pull request #4423 from ctiller/thd
Add tests for thread options
Diffstat (limited to 'test/core/support')
-rw-r--r--test/core/support/thd_test.c14
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;
}