aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc4
-rw-r--r--test/core/end2end/fixtures/proxy.cc4
-rw-r--r--test/core/gpr/arena_test.cc3
-rw-r--r--test/core/gpr/cpu_test.cc4
-rw-r--r--test/core/gpr/mpscq_test.cc8
-rw-r--r--test/core/gpr/spinlock_test.cc4
-rw-r--r--test/core/gpr/sync_test.cc6
-rw-r--r--test/core/gpr/tls_test.cc3
-rw-r--r--test/core/gprpp/thd_test.cc6
-rw-r--r--test/core/iomgr/combiner_test.cc5
-rw-r--r--test/core/iomgr/ev_epollsig_linux_test.cc3
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc3
-rw-r--r--test/core/surface/completion_queue_threading_test.cc7
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc14
14 files changed, 23 insertions, 51 deletions
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index d074fdaa52..58353376f3 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -21,7 +21,6 @@
#include "src/core/lib/iomgr/sockaddr.h"
#include <string.h>
-#include <new>
#include <grpc/grpc.h>
#include <grpc/slice_buffer.h>
@@ -551,7 +550,7 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
grpc_tcp_server_start(proxy->server, &proxy->pollset, 1, on_accept, proxy);
// Start proxy thread.
- new (&proxy->thd) grpc_core::Thread("grpc_http_proxy", thread_main, proxy);
+ proxy->thd = grpc_core::Thread("grpc_http_proxy", thread_main, proxy);
proxy->thd.Start();
return proxy;
}
@@ -566,7 +565,6 @@ void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) {
gpr_unref(&proxy->users); // Signal proxy thread to shutdown.
grpc_core::ExecCtx exec_ctx;
proxy->thd.Join();
- proxy->thd.~Thread();
grpc_tcp_server_shutdown_listeners(proxy->server);
grpc_tcp_server_unref(proxy->server);
gpr_free(proxy->proxy_name);
diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc
index 5b4f3b9236..042c858b4c 100644
--- a/test/core/end2end/fixtures/proxy.cc
+++ b/test/core/end2end/fixtures/proxy.cc
@@ -19,7 +19,6 @@
#include "test/core/end2end/fixtures/proxy.h"
#include <string.h>
-#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -98,7 +97,7 @@ grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def,
grpc_server_start(proxy->server);
grpc_call_details_init(&proxy->new_call_details);
- new (&proxy->thd) grpc_core::Thread("grpc_end2end_proxy", thread_main, proxy);
+ proxy->thd = grpc_core::Thread("grpc_end2end_proxy", thread_main, proxy);
proxy->thd.Start();
request_call(proxy);
@@ -123,7 +122,6 @@ void grpc_end2end_proxy_destroy(grpc_end2end_proxy* proxy) {
grpc_server_shutdown_and_notify(proxy->server, proxy->cq,
new_closure(shutdown_complete, proxy));
proxy->thd.Join();
- proxy->thd.~Thread();
gpr_free(proxy->proxy_port);
gpr_free(proxy->server_port);
grpc_server_destroy(proxy->server);
diff --git a/test/core/gpr/arena_test.cc b/test/core/gpr/arena_test.cc
index b00c014cea..111414ea3e 100644
--- a/test/core/gpr/arena_test.cc
+++ b/test/core/gpr/arena_test.cc
@@ -20,7 +20,6 @@
#include <inttypes.h>
#include <string.h>
-#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -102,7 +101,7 @@ static void concurrent_test(void) {
grpc_core::Thread thds[CONCURRENT_TEST_THREADS];
for (int i = 0; i < CONCURRENT_TEST_THREADS; i++) {
- new (&thds[i])
+ thds[i] =
grpc_core::Thread("grpc_concurrent_test", concurrent_test_body, &args);
thds[i].Start();
}
diff --git a/test/core/gpr/cpu_test.cc b/test/core/gpr/cpu_test.cc
index 279e6e6f5a..1052d40b42 100644
--- a/test/core/gpr/cpu_test.cc
+++ b/test/core/gpr/cpu_test.cc
@@ -25,7 +25,6 @@
#include <stdio.h>
#include <string.h>
-#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -118,7 +117,7 @@ static void cpu_test(void) {
static_cast<grpc_core::Thread*>(gpr_malloc(sizeof(*thd) * nthreads));
for (i = 0; i < nthreads; i++) {
- new (&thd[i]) grpc_core::Thread("grpc_cpu_test", &worker_thread, &ct);
+ thd[i] = grpc_core::Thread("grpc_cpu_test", &worker_thread, &ct);
thd[i].Start();
}
gpr_mu_lock(&ct.mu);
@@ -128,7 +127,6 @@ static void cpu_test(void) {
gpr_mu_unlock(&ct.mu);
for (i = 0; i < nthreads; i++) {
thd[i].Join();
- thd[i].~Thread();
}
gpr_free(thd);
fprintf(stderr, "Saw cores [");
diff --git a/test/core/gpr/mpscq_test.cc b/test/core/gpr/mpscq_test.cc
index 1e929fcf33..8c0873941f 100644
--- a/test/core/gpr/mpscq_test.cc
+++ b/test/core/gpr/mpscq_test.cc
@@ -19,7 +19,6 @@
#include "src/core/lib/gpr/mpscq.h"
#include <stdlib.h>
-#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -85,7 +84,7 @@ static void test_mt(void) {
ta[i].ctr = 0;
ta[i].q = &q;
ta[i].start = &start;
- new (&thds[i]) grpc_core::Thread("grpc_mt_test", test_thread, &ta[i]);
+ thds[i] = grpc_core::Thread("grpc_mt_test", test_thread, &ta[i]);
thds[i].Start();
}
size_t num_done = 0;
@@ -155,7 +154,7 @@ static void test_mt_multipop(void) {
ta[i].ctr = 0;
ta[i].q = &q;
ta[i].start = &start;
- new (&thds[i]) grpc_core::Thread("grpc_multipop_test", test_thread, &ta[i]);
+ thds[i] = grpc_core::Thread("grpc_multipop_test", test_thread, &ta[i]);
thds[i].Start();
}
pull_args pa;
@@ -167,8 +166,7 @@ static void test_mt_multipop(void) {
pa.start = &start;
gpr_mu_init(&pa.mu);
for (size_t i = 0; i < GPR_ARRAY_SIZE(pull_thds); i++) {
- new (&pull_thds[i])
- grpc_core::Thread("grpc_multipop_pull", pull_thread, &pa);
+ pull_thds[i] = grpc_core::Thread("grpc_multipop_pull", pull_thread, &pa);
pull_thds[i].Start();
}
gpr_event_set(&start, (void*)1);
diff --git a/test/core/gpr/spinlock_test.cc b/test/core/gpr/spinlock_test.cc
index ac9f70f301..0ee72edb15 100644
--- a/test/core/gpr/spinlock_test.cc
+++ b/test/core/gpr/spinlock_test.cc
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -69,7 +68,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->thread_count; 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();
}
}
@@ -79,7 +78,6 @@ static void test_wait(struct test* m) {
int i;
for (i = 0; i != m->thread_count; i++) {
m->threads[i].Join();
- m->threads[i].~Thread();
}
}
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 */
}
diff --git a/test/core/gpr/tls_test.cc b/test/core/gpr/tls_test.cc
index a060cd47f1..0502fc7ef4 100644
--- a/test/core/gpr/tls_test.cc
+++ b/test/core/gpr/tls_test.cc
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <new>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@@ -56,7 +55,7 @@ int main(int argc, char* argv[]) {
gpr_tls_init(&test_var);
for (auto& th : threads) {
- new (&th) grpc_core::Thread("grpc_tls_test", thd_body, nullptr);
+ th = grpc_core::Thread("grpc_tls_test", thd_body, nullptr);
th.Start();
}
for (auto& th : threads) {
diff --git a/test/core/gprpp/thd_test.cc b/test/core/gprpp/thd_test.cc
index a126784e72..82dd681049 100644
--- a/test/core/gprpp/thd_test.cc
+++ b/test/core/gprpp/thd_test.cc
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <new>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@@ -60,7 +59,7 @@ static void test1(void) {
t.n = NUM_THREADS;
t.is_done = 0;
for (auto& th : thds) {
- new (&th) grpc_core::Thread("grpc_thread_body1_test", &thd_body1, &t);
+ th = grpc_core::Thread("grpc_thread_body1_test", &thd_body1, &t);
th.Start();
}
gpr_mu_lock(&t.mu);
@@ -81,8 +80,7 @@ static void test2(void) {
grpc_core::Thread thds[NUM_THREADS];
for (auto& th : thds) {
bool ok;
- new (&th)
- grpc_core::Thread("grpc_thread_body2_test", &thd_body2, nullptr, &ok);
+ th = grpc_core::Thread("grpc_thread_body2_test", &thd_body2, nullptr, &ok);
GPR_ASSERT(ok);
th.Start();
}
diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc
index e4f4783e58..cf2c7db846 100644
--- a/test/core/iomgr/combiner_test.cc
+++ b/test/core/iomgr/combiner_test.cc
@@ -18,8 +18,6 @@
#include "src/core/lib/iomgr/combiner.h"
-#include <new>
-
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -105,8 +103,7 @@ static void test_execute_many(void) {
ta[i].ctr = 0;
ta[i].lock = lock;
gpr_event_init(&ta[i].done);
- new (&thds[i])
- grpc_core::Thread("grpc_execute_many", execute_many_loop, &ta[i]);
+ 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++) {
diff --git a/test/core/iomgr/ev_epollsig_linux_test.cc b/test/core/iomgr/ev_epollsig_linux_test.cc
index 4ec6fc8b0d..c3ba6d7c14 100644
--- a/test/core/iomgr/ev_epollsig_linux_test.cc
+++ b/test/core/iomgr/ev_epollsig_linux_test.cc
@@ -25,7 +25,6 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
-#include <new>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@@ -262,7 +261,7 @@ static void test_threading(void) {
grpc_core::Thread thds[10];
for (auto& th : thds) {
- new (&th) grpc_core::Thread("test_thread", test_threading_loop, &shared);
+ th = grpc_core::Thread("test_thread", test_threading_loop, &shared);
th.Start();
}
grpc_wakeup_fd fd;
diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc
index 895ede24c7..79b2b50e70 100644
--- a/test/core/iomgr/resolve_address_posix_test.cc
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -20,7 +20,6 @@
#include <string.h>
#include <sys/un.h>
-#include <new>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@@ -106,7 +105,7 @@ static void actually_poll(void* argsp) {
static void poll_pollset_until_request_done(args_struct* args) {
gpr_atm_rel_store(&args->done_atm, 0);
- new (&args->thd) grpc_core::Thread("grpc_poll_pollset", actually_poll, args);
+ args->thd = grpc_core::Thread("grpc_poll_pollset", actually_poll, args);
args->thd.Start();
}
diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc
index 1a76d7e6ae..9c8d8d8395 100644
--- a/test/core/surface/completion_queue_threading_test.cc
+++ b/test/core/surface/completion_queue_threading_test.cc
@@ -18,8 +18,6 @@
#include "src/core/lib/surface/completion_queue.h"
-#include <new>
-
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
@@ -96,7 +94,7 @@ static void test_too_many_plucks(void) {
}
thread_states[i].cc = cc;
thread_states[i].tag = tags[i];
- new (&threads[i])
+ threads[i] =
grpc_core::Thread("grpc_pluck_test", pluck_one, thread_states + i);
threads[i].Start();
}
@@ -234,7 +232,7 @@ static void test_threading(size_t producers, size_t consumers) {
options[i].id = optid++;
bool ok;
- new (&threads[i]) grpc_core::Thread(
+ threads[i] = grpc_core::Thread(
i < producers ? "grpc_producer" : "grpc_consumer",
i < producers ? producer_thread : consumer_thread, options + i, &ok);
GPR_ASSERT(ok);
@@ -273,7 +271,6 @@ static void test_threading(size_t producers, size_t consumers) {
for (i = 0; i < producers + consumers; i++) {
threads[i].Join();
- threads[i].~Thread();
}
gpr_free(threads);
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index 32b4ae1da8..c1298b6636 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -24,7 +24,6 @@
#include <memory.h>
#include <stdio.h>
-#include <new>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@@ -179,8 +178,7 @@ int run_concurrent_connectivity_test() {
char* localhost = gpr_strdup("localhost:54321");
grpc_core::Thread threads[NUM_THREADS];
for (auto& th : threads) {
- new (&th)
- grpc_core::Thread("grpc_wave_1", create_loop_destroy, localhost);
+ th = grpc_core::Thread("grpc_wave_1", create_loop_destroy, localhost);
th.Start();
}
for (auto& th : threads) {
@@ -204,8 +202,7 @@ int run_concurrent_connectivity_test() {
grpc_core::Thread threads[NUM_THREADS];
for (auto& th : threads) {
- new (&th)
- grpc_core::Thread("grpc_wave_2", create_loop_destroy, args.addr);
+ th = grpc_core::Thread("grpc_wave_2", create_loop_destroy, args.addr);
th.Start();
}
for (auto& th : threads) {
@@ -231,8 +228,7 @@ int run_concurrent_connectivity_test() {
grpc_core::Thread threads[NUM_THREADS];
for (auto& th : threads) {
- new (&th)
- grpc_core::Thread("grpc_wave_3", create_loop_destroy, args.addr);
+ th = grpc_core::Thread("grpc_wave_3", create_loop_destroy, args.addr);
th.Start();
}
for (auto& th : threads) {
@@ -291,8 +287,8 @@ int run_concurrent_watches_with_short_timeouts_test() {
char* localhost = gpr_strdup("localhost:54321");
for (auto& th : threads) {
- new (&th) grpc_core::Thread("grpc_short_watches",
- watches_with_short_timeouts, localhost);
+ th = grpc_core::Thread("grpc_short_watches", watches_with_short_timeouts,
+ localhost);
th.Start();
}
for (auto& th : threads) {