diff options
author | 2018-03-01 11:36:47 -0800 | |
---|---|---|
committer | 2018-03-01 11:47:36 -0800 | |
commit | 2fe87b09055cd256cdce038c4c70d92b955c991b (patch) | |
tree | a7652e9285797130e4d4ece7a6f271530be4b14f /test/core/gpr/sync_test.cc | |
parent | 8ffa1ae93310646cdf1b15c3a8c2655268d1a47f (diff) |
Move assignment for Thread, make destructor optional, loop cv waits
Diffstat (limited to 'test/core/gpr/sync_test.cc')
-rw-r--r-- | test/core/gpr/sync_test.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/core/gpr/sync_test.cc b/test/core/gpr/sync_test.cc index 487f394b14..24b4562819 100644 --- a/test/core/gpr/sync_test.cc +++ b/test/core/gpr/sync_test.cc @@ -22,7 +22,6 @@ #include <stdio.h> #include <stdlib.h> -#include <new> #include <grpc/support/alloc.h> #include <grpc/support/log.h> @@ -196,7 +195,7 @@ static void test_destroy(struct test* m) { static void test_create_threads(struct test* m, void (*body)(void* arg)) { int i; for (i = 0; i != m->nthreads; i++) { - new (&m->threads[i]) grpc_core::Thread("grpc_create_threads", body, m); + m->threads[i] = grpc_core::Thread("grpc_create_threads", body, m); m->threads[i].Start(); } } @@ -210,7 +209,6 @@ static void test_wait(struct test* m) { gpr_mu_unlock(&m->mu); for (int i = 0; i != m->nthreads; i++) { m->threads[i].Join(); - m->threads[i].~Thread(); } } @@ -258,7 +256,7 @@ static void test(const char* name, void (*body)(void* m), m = test_new(10, iterations, incr_step); grpc_core::Thread extra_thd; if (extra != nullptr) { - new (&extra_thd) grpc_core::Thread(name, extra, m); + extra_thd = grpc_core::Thread(name, extra, m); extra_thd.Start(); m->done++; /* one more thread to wait for */ } |