GRPC Core  9.0.0
Data Structures | Macros | Typedefs | Functions
init.cc File Reference
#include <grpc/support/port_platform.h>
#include <limits.h>
#include <memory.h>
#include <grpc/fork.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channelz_registry.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/handshaker_registry.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/fork.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/http/parser.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/resource_quota.h"
#include "src/core/lib/iomgr/timer_manager.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/surface/init.h"
#include "src/core/lib/surface/lame_client.h"
#include "src/core/lib/surface/server.h"
#include "src/core/lib/transport/bdp_estimator.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/transport_impl.h"

Data Structures

struct  grpc_plugin
 

Macros

#define MAX_PLUGINS   128
 

Typedefs

typedef struct grpc_plugin grpc_plugin
 

Functions

void grpc_register_built_in_plugins (void)
 
void grpc_register_plugin (void(*init)(void), void(*destroy)(void))
 Registers a plugin to be initialized and destroyed with the library. More...
 
void grpc_init (void)
 Initialize the grpc library. More...
 
void grpc_shutdown_internal_locked (void)
 
void grpc_shutdown_internal (void *)
 
void grpc_shutdown (void)
 Shut down the grpc library. More...
 
void grpc_shutdown_blocking (void)
 EXPERIMENTAL. More...
 
int grpc_is_initialized (void)
 EXPERIMENTAL. More...
 
void grpc_maybe_wait_for_async_shutdown (void)
 

Macro Definition Documentation

◆ MAX_PLUGINS

#define MAX_PLUGINS   128

Typedef Documentation

◆ grpc_plugin

typedef struct grpc_plugin grpc_plugin

Function Documentation

◆ grpc_init()

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).

◆ grpc_is_initialized()

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

◆ grpc_maybe_wait_for_async_shutdown()

void grpc_maybe_wait_for_async_shutdown ( void  )

◆ grpc_register_built_in_plugins()

void grpc_register_built_in_plugins ( void  )

◆ grpc_register_plugin()

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.

◆ grpc_shutdown()

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.

◆ grpc_shutdown_blocking()

void grpc_shutdown_blocking ( void  )

EXPERIMENTAL.

Blocking shut down grpc library. This is only for wrapped language to use now.

◆ grpc_shutdown_internal()

void grpc_shutdown_internal ( void *  )

◆ grpc_shutdown_internal_locked()

void grpc_shutdown_internal_locked ( void  )