aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/gpr/arena_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/gpr/arena_test.cc
parent5e1298f0a826777b0e5b844328b81216e9c37476 (diff)
C++ize gpr_thread as grpc_core::Thread, make it 2-phase init (construct/Start)
Diffstat (limited to 'test/core/gpr/arena_test.cc')
-rw-r--r--test/core/gpr/arena_test.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/core/gpr/arena_test.cc b/test/core/gpr/arena_test.cc
index 1cfaefa686..717052eacd 100644
--- a/test/core/gpr/arena_test.cc
+++ b/test/core/gpr/arena_test.cc
@@ -18,15 +18,17 @@
#include "src/core/lib/gpr/arena.h"
+#include <new>
+#include <inttypes.h>
+#include <string.h>
+
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
-#include <inttypes.h>
-#include <string.h>
#include "src/core/lib/gpr/string.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,16 +99,18 @@ static void concurrent_test(void) {
gpr_event_init(&args.ev_start);
args.arena = gpr_arena_create(1024);
- gpr_thd_id thds[CONCURRENT_TEST_THREADS];
+ grpc_core::Thread thds[CONCURRENT_TEST_THREADS];
for (int i = 0; i < CONCURRENT_TEST_THREADS; i++) {
- gpr_thd_new(&thds[i], "grpc_concurrent_test", concurrent_test_body, &args);
+ new (&thds[i]) grpc_core::Thread("grpc_concurrent_test",
+ concurrent_test_body, &args);
+ thds[i].Start();
}
gpr_event_set(&args.ev_start, (void*)1);
- for (int i = 0; i < CONCURRENT_TEST_THREADS; i++) {
- gpr_thd_join(thds[i]);
+ for (auto& th : thds) {
+ th.Join();
}
gpr_arena_destroy(args.arena);