diff options
author | Vijay Pai <vpai@google.com> | 2018-02-16 22:59:03 -0800 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2018-02-19 22:39:58 -0800 |
commit | da69355f30ca6863cc07c0aebffc5a14900de265 (patch) | |
tree | 83c866fcf54b2c058d452312109175cbb2107865 /test/core/handshake | |
parent | 5e1298f0a826777b0e5b844328b81216e9c37476 (diff) |
C++ize gpr_thread as grpc_core::Thread, make it 2-phase init (construct/Start)
Diffstat (limited to 'test/core/handshake')
-rw-r--r-- | test/core/handshake/client_ssl.cc | 10 | ||||
-rw-r--r-- | test/core/handshake/readahead_handshaker_server_ssl.cc | 1 | ||||
-rw-r--r-- | test/core/handshake/server_ssl.cc | 1 | ||||
-rw-r--r-- | test/core/handshake/server_ssl_common.cc | 10 | ||||
-rw-r--r-- | test/core/handshake/server_ssl_common.h | 1 |
5 files changed, 12 insertions, 11 deletions
diff --git a/test/core/handshake/client_ssl.cc b/test/core/handshake/client_ssl.cc index 2581eb525c..8ac763ac4b 100644 --- a/test/core/handshake/client_ssl.cc +++ b/test/core/handshake/client_ssl.cc @@ -35,7 +35,7 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include "src/core/lib/gpr/thd.h" +#include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -230,9 +230,11 @@ static bool client_ssl_test(char* server_alpn_preferred) { GPR_ASSERT(server_socket > 0 && port > 0); // Launch the TLS server thread. - gpr_thd_id thdid; server_args args = {server_socket, server_alpn_preferred}; - GPR_ASSERT(gpr_thd_new(&thdid, "grpc_client_ssl_test", server_thread, &args)); + bool ok; + grpc_core::Thread thd("grpc_client_ssl_test", server_thread, &args, &ok); + GPR_ASSERT(ok); + thd.Start(); // Load key pair and establish client SSL credentials. grpc_ssl_pem_key_cert_pair pem_key_cert_pair; @@ -300,7 +302,7 @@ static bool client_ssl_test(char* server_alpn_preferred) { grpc_slice_unref(key_slice); grpc_slice_unref(ca_slice); - gpr_thd_join(thdid); + thd.Join(); grpc_shutdown(); diff --git a/test/core/handshake/readahead_handshaker_server_ssl.cc b/test/core/handshake/readahead_handshaker_server_ssl.cc index 80000ca8d3..9788320e0d 100644 --- a/test/core/handshake/readahead_handshaker_server_ssl.cc +++ b/test/core/handshake/readahead_handshaker_server_ssl.cc @@ -30,7 +30,6 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include "src/core/lib/gpr/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/handshake/server_ssl.cc b/test/core/handshake/server_ssl.cc index f0465c8e3e..8fa5f7fb35 100644 --- a/test/core/handshake/server_ssl.cc +++ b/test/core/handshake/server_ssl.cc @@ -30,7 +30,6 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include "src/core/lib/gpr/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/handshake/server_ssl_common.cc b/test/core/handshake/server_ssl_common.cc index a2d389954f..41b2829d8b 100644 --- a/test/core/handshake/server_ssl_common.cc +++ b/test/core/handshake/server_ssl_common.cc @@ -32,7 +32,7 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include "src/core/lib/gpr/thd.h" +#include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -138,8 +138,10 @@ bool server_ssl_test(const char* alpn_list[], unsigned int alpn_list_len, gpr_event_init(&client_handshake_complete); // Launch the gRPC server thread. - gpr_thd_id thdid; - GPR_ASSERT(gpr_thd_new(&thdid, "grpc_ssl_test", server_thread, &port)); + bool ok; + grpc_core::Thread thd("grpc_ssl_test", server_thread, &port, &ok); + GPR_ASSERT(ok); + thd.Start(); SSL_load_error_strings(); OpenSSL_add_ssl_algorithms(); @@ -232,7 +234,7 @@ bool server_ssl_test(const char* alpn_list[], unsigned int alpn_list_len, EVP_cleanup(); close(sock); - gpr_thd_join(thdid); + thd.Join(); grpc_shutdown(); diff --git a/test/core/handshake/server_ssl_common.h b/test/core/handshake/server_ssl_common.h index f726a1cd3a..32bc6f9897 100644 --- a/test/core/handshake/server_ssl_common.h +++ b/test/core/handshake/server_ssl_common.h @@ -26,7 +26,6 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include "src/core/lib/gpr/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" |