@ -123,7 +123,7 @@ static void* run_poll_channels_loop_unblocking_func_wrapper(void* arg);
// Needs to be called under global_connection_polling_mu
static void grpc_rb_channel_watch_connection_state_op_complete (
watch_state_op * op , int success ) {
GPR_ASSERT ( ! op - > op . api_callback_args . called_back ) ;
GR PC_ RUBY _ASSERT ( ! op - > op . api_callback_args . called_back ) ;
op - > op . api_callback_args . called_back = 1 ;
op - > op . api_callback_args . success = success ;
// wake up the watch API call that's waiting on this op
@ -133,7 +133,7 @@ static void grpc_rb_channel_watch_connection_state_op_complete(
/* Avoids destroying a channel twice. */
static void grpc_rb_channel_safe_destroy ( bg_watched_channel * bg ) {
gpr_mu_lock ( & global_connection_polling_mu ) ;
GPR_ASSERT ( bg_watched_channel_list_lookup ( bg ) ) ;
GR PC_ RUBY _ASSERT ( bg_watched_channel_list_lookup ( bg ) ) ;
if ( ! bg - > channel_destroyed ) {
grpc_channel_destroy ( bg - > channel ) ;
bg - > channel_destroyed = 1 ;
@ -253,7 +253,7 @@ static VALUE grpc_rb_channel_init(int argc, VALUE* argv, VALUE self) {
ch = grpc_channel_create ( target_chars , creds , & wrapper - > args ) ;
}
GPR_ASSERT ( ch ) ;
GR PC_ RUBY _ASSERT ( ch ) ;
stack . channel = ch ;
stack . wrapper = wrapper ;
rb_thread_call_without_gvl (
@ -416,7 +416,7 @@ static void grpc_rb_channel_maybe_recreate_channel_after_fork(
if ( bg - > channel_destroyed ) {
// There must be one ref at this point, held by the ruby-level channel
// object, drop this one here.
GPR_ASSERT ( bg - > refcount = = 1 ) ;
GR PC_ RUBY _ASSERT ( bg - > refcount = = 1 ) ;
rb_thread_call_without_gvl ( channel_safe_destroy_without_gil , bg , NULL ,
NULL ) ;
// re-create C-core channel
@ -581,8 +581,8 @@ static void bg_watched_channel_list_free_and_remove(
bg_watched_channel * target ) {
bg_watched_channel * bg = NULL ;
GPR_ASSERT ( bg_watched_channel_list_lookup ( target ) ) ;
GPR_ASSERT ( target - > channel_destroyed & & target - > refcount = = 0 ) ;
GR PC_ RUBY _ASSERT ( bg_watched_channel_list_lookup ( target ) ) ;
GR PC_ RUBY _ASSERT ( target - > channel_destroyed & & target - > refcount = = 0 ) ;
if ( bg_watched_channel_list_head = = target ) {
bg_watched_channel_list_head = target - > next ;
gpr_free ( target ) ;
@ -597,7 +597,7 @@ static void bg_watched_channel_list_free_and_remove(
}
bg = bg - > next ;
}
GPR_ASSERT ( 0 ) ;
GR PC_ RUBY _ASSERT ( 0 ) ;
}
/* Initialize a grpc_rb_channel's "protected grpc_channel" and try to push
@ -621,11 +621,11 @@ static void grpc_rb_channel_try_register_connection_polling(
grpc_connectivity_state conn_state ;
watch_state_op * op = NULL ;
if ( bg - > refcount = = 0 ) {
GPR_ASSERT ( bg - > channel_destroyed ) ;
GR PC_ RUBY _ASSERT ( bg - > channel_destroyed ) ;
bg_watched_channel_list_free_and_remove ( bg ) ;
return ;
}
GPR_ASSERT ( bg - > refcount = = 1 ) ;
GR PC_ RUBY _ASSERT ( bg - > refcount = = 1 ) ;
if ( bg - > channel_destroyed | | g_abort_channel_polling ) {
return ;
}
@ -633,7 +633,7 @@ static void grpc_rb_channel_try_register_connection_polling(
if ( conn_state = = GRPC_CHANNEL_SHUTDOWN ) {
return ;
}
GPR_ASSERT ( bg_watched_channel_list_lookup ( bg ) ) ;
GR PC_ RUBY _ASSERT ( bg_watched_channel_list_lookup ( bg ) ) ;
// prevent bg from being free'd by GC while background thread is watching it
bg - > refcount + + ;
op = gpr_zalloc ( sizeof ( watch_state_op ) ) ;
@ -679,7 +679,7 @@ static void* run_poll_channels_loop_no_gil(void* arg) {
grpc_rb_channel_watch_connection_state_op_complete (
( watch_state_op * ) event . tag , event . success ) ;
} else {
GPR_ASSERT ( 0 ) ;
GR PC_ RUBY _ASSERT ( 0 ) ;
}
}
gpr_mu_unlock ( & global_connection_polling_mu ) ;
@ -769,9 +769,9 @@ static void do_basic_init() {
*/
void grpc_rb_channel_polling_thread_start ( ) {
gpr_once_init ( & g_once_init , do_basic_init ) ;
GPR_ASSERT ( ! RTEST ( g_channel_polling_thread ) ) ;
GPR_ASSERT ( ! g_abort_channel_polling ) ;
GPR_ASSERT ( g_channel_polling_cq = = NULL ) ;
GR PC_ RUBY _ASSERT ( ! RTEST ( g_channel_polling_thread ) ) ;
GR PC_ RUBY _ASSERT ( ! g_abort_channel_polling ) ;
GR PC_ RUBY _ASSERT ( g_channel_polling_cq = = NULL ) ;
g_channel_polling_cq = grpc_completion_queue_create_for_next ( NULL ) ;
g_channel_polling_thread = rb_thread_create ( run_poll_channels_loop , NULL ) ;