diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2016-02-20 22:48:56 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2016-02-20 22:48:56 +0100 |
commit | b5b62720c5ce22c7d479a76546858ec90dd213b2 (patch) | |
tree | 7a3974af72f2a7b3a1b46053d9c6880e0d29eea7 | |
parent | 91d0ad0fde510bc2d860044417409c7e0a9b229d (diff) |
Fixing a reported ruby crash when using ruby_vm_at_exit.
-rw-r--r-- | src/ruby/ext/grpc/rb_grpc.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index eefdb93d67..1f887d69b5 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -269,20 +269,10 @@ static void Init_grpc_time_consts() { id_tv_nsec = rb_intern("tv_nsec"); } -/* - TODO: find an alternative to ruby_vm_at_exit that is ok in Ruby 2.0 where - RUBY_TYPED_FREE_IMMEDIATELY is not defined. - - At the moment, registering a function using ruby_vm_at_exit segfaults in Ruby - 2.0. This is not an issue with the gRPC handler. More likely, this was an - in issue with 2.0 that got resolved in 2.1 and has not been backported. -*/ -#ifdef RUBY_TYPED_FREE_IMMEDIATELY -static void grpc_rb_shutdown(ruby_vm_t *vm) { - (void)vm; +static void grpc_rb_shutdown(VALUE val) { + (void)val; grpc_shutdown(); } -#endif /* Initialize the GRPC module structs */ @@ -308,10 +298,7 @@ void Init_grpc_c() { grpc_init(); -/* TODO: find alternative to ruby_vm_at_exit that is ok in Ruby 2.0 */ -#ifdef RUBY_TYPED_FREE_IMMEDIATELY - ruby_vm_at_exit(grpc_rb_shutdown); -#endif + rb_set_end_proc(grpc_rb_shutdown, Qnil); grpc_rb_mGRPC = rb_define_module("GRPC"); grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core"); |