diff options
Diffstat (limited to 'test/cpp/interop/server_helper.h')
-rw-r--r-- | test/cpp/interop/server_helper.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h index 6af003fe93..1bf7db1e14 100644 --- a/test/cpp/interop/server_helper.h +++ b/test/cpp/interop/server_helper.h @@ -19,6 +19,7 @@ #ifndef GRPC_TEST_CPP_INTEROP_SERVER_HELPER_H #define GRPC_TEST_CPP_INTEROP_SERVER_HELPER_H +#include <condition_variable> #include <memory> #include <grpc/compression.h> @@ -50,8 +51,27 @@ class InteropServerContextInspector { namespace interop { extern gpr_atm g_got_sigint; + +struct ServerStartedCondition { + std::mutex mutex; + std::condition_variable condition; + bool server_started = false; +}; + +/// Run gRPC interop server using port FLAGS_port. +/// +/// \param creds The credentials associated with the server. void RunServer(std::shared_ptr<ServerCredentials> creds); +/// Run gRPC interop server. +/// +/// \param creds The credentials associated with the server. +/// \param port Port to use for the server. +/// \param server_started_condition (optional) Struct holding mutex, condition +/// variable, and condition used to notify when the server has started. +void RunServer(std::shared_ptr<ServerCredentials> creds, int port, + ServerStartedCondition* server_started_condition); + } // namespace interop } // namespace testing } // namespace grpc |