module GRPC
GRPC
is the general RPC module
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
GRPC
contains the General RPC module.
Constants
- VERSION
Public Class Methods
logger=(logger_obj)
click to toggle source
# File src/ruby/lib/grpc/logconfig.rb, line 17 def self.logger=(logger_obj) # Need a free variable here to keep value of logger_obj for logger closure @logger = logger_obj extend( Module.new do def logger @logger end end ) end
postfork_child()
click to toggle source
static VALUE grpc_rb_postfork_child(VALUE self) { if (!g_grpc_rb_prefork_pending) { rb_raise(rb_eRuntimeError, "GRPC::postfork_child can only be called once following a " "GRPC::prefork"); } if (grpc_ruby_initial_pid()) { rb_raise(rb_eRuntimeError, "GRPC.postfork_child must be called only from the child process " "after a fork"); } grpc_ruby_reset_init_state(); grpc_ruby_init_threads(); g_grpc_rb_prefork_pending = false; return Qnil; }
postfork_parent()
click to toggle source
static VALUE grpc_rb_postfork_parent(VALUE self) { // TODO(apolcyn): check calling thread vs. thread that gRPC was initialized on if (!g_grpc_rb_prefork_pending) { rb_raise(rb_eRuntimeError, "GRPC::postfork_parent can only be called once following a " "GRPC::prefork"); } if (!grpc_ruby_initial_pid()) { rb_raise(rb_eRuntimeError, "GRPC.postfork_parent must be called only from the parent process " "after a fork"); } if (!grpc_ruby_initial_thread()) { rb_raise(rb_eRuntimeError, "GRPC.postfork_parent needs to be called from the same thread " "that GRPC.prefork (and fork) was called from"); } grpc_ruby_init_threads(); g_grpc_rb_prefork_pending = false; return Qnil; }
prefork()
click to toggle source
static VALUE grpc_rb_prefork(VALUE self) { // This might be the first time we've called into the grpc library, so make // sure basic one-time initialization is taken care of. Note that if this is // the case, then grpc_init() will start up c-core threads; that's OK since // they will be shut down in C-core's pthread_atfork handler. gpr_once_init(&g_once_init, grpc_ruby_basic_init); grpc_init(); if (!g_enable_fork_support) { rb_raise(rb_eRuntimeError, "forking with gRPC/Ruby is only supported on linux with env var: " "GRPC_ENABLE_FORK_SUPPORT=1"); } if (g_grpc_rb_prefork_pending) { rb_raise(rb_eRuntimeError, "GRPC.prefork already called without a matching " "GRPC.postfork_{parent,child}"); } if (!grpc_ruby_initial_thread()) { rb_raise(rb_eRuntimeError, "GRPC.prefork and fork need to be called from the same thread " "that GRPC was initialized on (GRPC lazy-initializes when when " "the first GRPC object is created"); } if (g_grpc_rb_num_fork_unsafe_threads > 0) { rb_raise( rb_eRuntimeError, "Detected at least %ld threads actively using grpc, so it is not safe " "call GRPC.prefork or fork. Note that grpc-ruby servers and " "bidirectional " "streams manage background threads and are not fork safe.", g_grpc_rb_num_fork_unsafe_threads); } g_grpc_rb_prefork_pending = true; rb_mutex_lock(g_bg_thread_init_rb_mu); if (g_bg_thread_init_done) { grpc_rb_channel_polling_thread_stop(); grpc_rb_event_queue_thread_stop(); // all ruby-level background threads joined at this point g_bg_thread_init_done = false; } rb_mutex_unlock(g_bg_thread_init_rb_mu); return Qnil; }