Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/lib/surface/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#ifndef GRPC_SRC_CORE_LIB_SURFACE_INIT_H
#define GRPC_SRC_CORE_LIB_SURFACE_INIT_H

#include <grpc/support/port_platform.h>

#include "absl/time/time.h"

#include <grpc/support/port_platform.h>

void grpc_maybe_wait_for_async_shutdown(void);

// Returns false if the timeout expired before fully shut down.
Expand Down
7 changes: 3 additions & 4 deletions src/core/tsi/ssl_transport_security.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@

#include "src/core/tsi/ssl_transport_security.h"

#include <cstdlib>
#include <limits.h>
#include <string.h>

#include <cstdlib>

#include <grpc/support/port_platform.h>

#include "src/core/lib/surface/init.h"
Expand Down Expand Up @@ -195,9 +196,7 @@ static void init_openssl(void) {
// OPENSSL registers an exit handler to clean up global objects, which
// otherwise may happen before gRPC removes all references to OPENSSL. Below
// exit handler is guaranteed to run after OPENSSL's.
std::atexit([](){
grpc_wait_for_shutdown_with_timeout(absl::Seconds(2));
});
std::atexit([]() { grpc_wait_for_shutdown_with_timeout(absl::Seconds(2)); });
#else
SSL_library_init();
SSL_load_error_strings();
Expand Down
7 changes: 2 additions & 5 deletions test/core/surface/init_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ TEST(Init, Repeatedly) {
EXPECT_FALSE(grpc_is_initialized());
}


TEST(Init, WaitForShutdownBeforeInit) {
EXPECT_TRUE(grpc_wait_for_shutdown_with_timeout(absl::ZeroDuration()));
}
Expand All @@ -134,15 +133,13 @@ TEST(Init, WaitForShutdownWithTimeout) {
grpc_core::Thread t0(
"init_test",
[](void*) {
EXPECT_FALSE(
grpc_wait_for_shutdown_with_timeout(absl::Seconds(0.5)));
EXPECT_FALSE(grpc_wait_for_shutdown_with_timeout(absl::Seconds(0.5)));
},
nullptr);
grpc_core::Thread t1(
"init_test",
[](void*) {
EXPECT_TRUE(
grpc_wait_for_shutdown_with_timeout(absl::Seconds(1.5)));
EXPECT_TRUE(grpc_wait_for_shutdown_with_timeout(absl::Seconds(1.5)));
},
nullptr);
t0.Start();
Expand Down