diff options
author | Andrei Belov <defan@nginx.com> | 2021-02-04 18:40:45 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2021-02-04 18:40:45 +0300 |
commit | 0997fa324ca523ab282f595ac9f44b3e4daff86a (patch) | |
tree | 37424fff265780f34f9a9adb7ddd7501a67843f1 /src/ruby | |
parent | 2bc99c614d5547e773bda73364efada47f0a37bf (diff) | |
parent | 774a6034d9daf32ac6c98da7e4c0ca9e820536b4 (diff) | |
download | unit-0997fa324ca523ab282f595ac9f44b3e4daff86a.tar.gz unit-0997fa324ca523ab282f595ac9f44b3e4daff86a.tar.bz2 |
Merged with the default branch.
Diffstat (limited to 'src/ruby')
-rw-r--r-- | src/ruby/nxt_ruby.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c index 698d4a43..0aad887d 100644 --- a/src/ruby/nxt_ruby.c +++ b/src/ruby/nxt_ruby.c @@ -38,6 +38,7 @@ static int nxt_ruby_init_io(nxt_ruby_ctx_t *rctx); static void nxt_ruby_request_handler(nxt_unit_request_info_t *req); static void *nxt_ruby_request_handler_gvl(void *req); static int nxt_ruby_ready_handler(nxt_unit_ctx_t *ctx); +static void *nxt_ruby_thread_create_gvl(void *rctx); static VALUE nxt_ruby_thread_func(VALUE arg); static void *nxt_ruby_unit_run(void *ctx); static void nxt_ruby_ubf(void *ctx); @@ -1141,7 +1142,7 @@ nxt_ruby_ready_handler(nxt_unit_ctx_t *ctx) rctx->ctx = ctx; - res = rb_thread_create(RUBY_METHOD_FUNC(nxt_ruby_thread_func), rctx); + res = (VALUE) rb_thread_call_with_gvl(nxt_ruby_thread_create_gvl, rctx); if (nxt_fast_path(res != Qnil)) { nxt_unit_debug(ctx, "thread #%d created", (int) (i + 1)); @@ -1159,6 +1160,17 @@ nxt_ruby_ready_handler(nxt_unit_ctx_t *ctx) } +static void * +nxt_ruby_thread_create_gvl(void *rctx) +{ + VALUE res; + + res = rb_thread_create(RUBY_METHOD_FUNC(nxt_ruby_thread_func), rctx); + + return (void *) (uintptr_t) res; +} + + static VALUE nxt_ruby_thread_func(VALUE arg) { |