diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-11-05 17:02:55 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-11-05 17:02:55 +0300 |
commit | 2220b8258f116d12f9cf6eb4133f41ec374b75f5 (patch) | |
tree | 49e5852d89cdb16f973d49653b02919d3370147a /src/ruby/nxt_ruby.c | |
parent | fc9a012ceb83edc5511dccb55a90ea15ab52f337 (diff) | |
download | unit-2220b8258f116d12f9cf6eb4133f41ec374b75f5.tar.gz unit-2220b8258f116d12f9cf6eb4133f41ec374b75f5.tar.bz2 |
Ruby: error checking during thread creation.
Application terminates in case of thread creation failure.
Diffstat (limited to '')
-rw-r--r-- | src/ruby/nxt_ruby.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c index ffc1469a..698d4a43 100644 --- a/src/ruby/nxt_ruby.c +++ b/src/ruby/nxt_ruby.c @@ -1150,6 +1150,8 @@ nxt_ruby_ready_handler(nxt_unit_ctx_t *ctx) } else { nxt_unit_alert(ctx, "thread #%d create failed", (int) (i + 1)); + + return NXT_UNIT_ERROR; } } @@ -1253,7 +1255,7 @@ nxt_ruby_join_threads(nxt_unit_ctx_t *ctx, nxt_ruby_app_conf_t *c) return; } - for(i = 0; i < c->threads - 1; i++) { + for (i = 0; i < c->threads - 1; i++) { rctx = &nxt_ruby_ctxs[i]; if (rctx->thread != Qnil) { @@ -1264,8 +1266,10 @@ nxt_ruby_join_threads(nxt_unit_ctx_t *ctx, nxt_ruby_app_conf_t *c) } else { nxt_unit_debug(ctx, "thread #%d not started", (int) (i + 1)); } + } - nxt_ruby_ctx_done(rctx); + for (i = 0; i < c->threads - 1; i++) { + nxt_ruby_ctx_done(&nxt_ruby_ctxs[i]); } nxt_unit_free(ctx, nxt_ruby_ctxs); |