aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/ext/grpc/rb_compression_options.c
diff options
context:
space:
mode:
authorGravatar Alexander Polcyn <apolcyn@google.com>2017-04-14 12:10:55 -0700
committerGravatar Alexander Polcyn <apolcyn@google.com>2017-04-14 15:19:00 -0700
commit2a9b5d77ed0b139f71f9b9e04e527fb09afdbec9 (patch)
tree80b3fdc55e3a1cd350fe811fb5818532e19be777 /src/ruby/ext/grpc/rb_compression_options.c
parentbb75f3ea820b8c2d0f0ac1dc66a62f7ded9e6f22 (diff)
defer grpc_init and background threads until first grpc object init
Diffstat (limited to 'src/ruby/ext/grpc/rb_compression_options.c')
-rw-r--r--src/ruby/ext/grpc/rb_compression_options.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ruby/ext/grpc/rb_compression_options.c b/src/ruby/ext/grpc/rb_compression_options.c
index 6b2467ee46..b23e82b0db 100644
--- a/src/ruby/ext/grpc/rb_compression_options.c
+++ b/src/ruby/ext/grpc/rb_compression_options.c
@@ -100,8 +100,11 @@ static rb_data_type_t grpc_rb_compression_options_data_type = {
Allocate the wrapped grpc compression options and
initialize it here too. */
static VALUE grpc_rb_compression_options_alloc(VALUE cls) {
- grpc_rb_compression_options *wrapper =
- gpr_malloc(sizeof(grpc_rb_compression_options));
+ grpc_rb_compression_options *wrapper = NULL;
+
+ grpc_ruby_once_init();
+
+ wrapper = gpr_malloc(sizeof(grpc_rb_compression_options));
wrapper->wrapped = NULL;
wrapper->wrapped = gpr_malloc(sizeof(grpc_compression_options));
grpc_compression_options_init(wrapper->wrapped);