aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/iomgr/combiner_test.cc
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-02-16 22:59:03 -0800
committerGravatar Vijay Pai <vpai@google.com>2018-02-19 22:39:58 -0800
commitda69355f30ca6863cc07c0aebffc5a14900de265 (patch)
tree83c866fcf54b2c058d452312109175cbb2107865 /test/core/iomgr/combiner_test.cc
parent5e1298f0a826777b0e5b844328b81216e9c37476 (diff)
C++ize gpr_thread as grpc_core::Thread, make it 2-phase init (construct/Start)
Diffstat (limited to 'test/core/iomgr/combiner_test.cc')
-rw-r--r--test/core/iomgr/combiner_test.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc
index 0cd63bd973..45afe53564 100644
--- a/test/core/iomgr/combiner_test.cc
+++ b/test/core/iomgr/combiner_test.cc
@@ -18,11 +18,13 @@
#include "src/core/lib/iomgr/combiner.h"
+#include <new>
+
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/lib/gpr/thd.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/gpr/useful.h"
#include "test/core/util/test_config.h"
@@ -97,19 +99,20 @@ static void test_execute_many(void) {
gpr_log(GPR_DEBUG, "test_execute_many");
grpc_combiner* lock = grpc_combiner_create();
- gpr_thd_id thds[100];
+ grpc_core::Thread thds[100];
thd_args ta[GPR_ARRAY_SIZE(thds)];
for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) {
ta[i].ctr = 0;
ta[i].lock = lock;
gpr_event_init(&ta[i].done);
- GPR_ASSERT(
- gpr_thd_new(&thds[i], "grpc_execute_many", execute_many_loop, &ta[i]));
+ new (&thds[i]) grpc_core::Thread("grpc_execute_many",
+ execute_many_loop, &ta[i]);
+ thds[i].Start();
}
for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) {
GPR_ASSERT(gpr_event_wait(&ta[i].done,
gpr_inf_future(GPR_CLOCK_REALTIME)) != nullptr);
- gpr_thd_join(thds[i]);
+ thds[i].Join();
}
grpc_core::ExecCtx exec_ctx;
GRPC_COMBINER_UNREF(lock, "test_execute_many");