#include <grpc/support/port_platform.h>
#include "src/core/lib/surface/init.h"
#include <limits.h>
#include <stdint.h>
#include "absl/base/thread_annotations.h"
#include <grpc/fork.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack_builder.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/event_engine/forkable.h"
#include "src/core/lib/gprpp/fork.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/timer_manager.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/security/authorization/grpc_server_authz_filter.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/security_connector.h"
#include "src/core/lib/security/transport/auth_filters.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/surface/completion_queue.h"
Go to the source code of this file.
Classes | |
struct | grpc_plugin |
Namespaces | |
grpc_core | |
Macros | |
#define | MAX_PLUGINS 128 |
Typedefs | |
typedef struct grpc_plugin | grpc_plugin |
Functions | |
static int g_initializations | ABSL_GUARDED_BY (g_init_mu) = false |
static void | do_basic_init (void) |
void | grpc_init (void) |
int | grpc_is_initialized (void) |
void | grpc_maybe_wait_for_async_shutdown (void) |
void | grpc_register_built_in_plugins (void) |
void | grpc_register_plugin (void(*init)(void), void(*destroy)(void)) |
void | grpc_shutdown (void) |
void | grpc_shutdown_blocking (void) |
void | grpc_shutdown_internal (void *) |
void | grpc_shutdown_internal_locked (void) ABSL_EXCLUSIVE_LOCKS_REQUIRED(g_init_mu) |
static bool | maybe_prepend_client_auth_filter (grpc_core::ChannelStackBuilder *builder) |
static bool | maybe_prepend_grpc_server_authz_filter (grpc_core::ChannelStackBuilder *builder) |
static bool | maybe_prepend_server_auth_filter (grpc_core::ChannelStackBuilder *builder) |
void | grpc_core::RegisterSecurityFilters (CoreConfiguration::Builder *builder) |
Variables | |
static grpc_plugin | g_all_of_the_plugins [MAX_PLUGINS] |
static gpr_once | g_basic_init = GPR_ONCE_INIT |
static grpc_core::Mutex * | g_init_mu |
static int | g_number_of_plugins = 0 |
static grpc_core::CondVar * | g_shutting_down_cv |
typedef struct grpc_plugin grpc_plugin |
void grpc_init | ( | void | ) |
Initialize the grpc library.
After it's called, a matching invocation to grpc_shutdown() is expected.
It is not safe to call any other grpc functions before calling this. (To avoid overhead, little checking is done, and some things may work. We do not warrant that they will continue to do so in future revisions of this library).
int grpc_is_initialized | ( | void | ) |
EXPERIMENTAL. Returns 1 if the grpc library has been initialized. TODO(ericgribkoff) Decide if this should be promoted to non-experimental as part of stabilizing the fork support API, as tracked in https://github.com/grpc/grpc/issues/15334
void grpc_register_built_in_plugins | ( | void | ) |
Definition at line 32 of file grpc_cronet_plugin_registry.cc.
void grpc_register_plugin | ( | void(*)(void) | init, |
void(*)(void) | destroy | ||
) |
Registers a plugin to be initialized and destroyed with the library.
The init and destroy functions will be invoked as part of grpc_init() and grpc_shutdown(), respectively. Note that these functions can be invoked an arbitrary number of times (and hence so will init and destroy). It is safe to pass NULL to either argument. Plugins are destroyed in the reverse order they were initialized.
void grpc_shutdown | ( | void | ) |
Shut down the grpc library.
Before it's called, there should haven been a matching invocation to grpc_init().
The last call to grpc_shutdown will initiate cleaning up of grpc library internals, which can happen in another thread. Once the clean-up is done, no memory is used by grpc, nor are any instructions executing within the grpc library. Prior to calling, all application owned grpc objects must have been destroyed.
void grpc_shutdown_blocking | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |