summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-27 23:05:56 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-11-27 23:06:29 -0800
commit1d1200555faa22683b7d2436f77c00f55044bba1 (patch)
tree72c720db7802b578bc41f292fb8f4869db98f2de /mjit.c
parent168b0e1f025a3c8927bbf548cc4631862fe22d29 (diff)
MJIT: Avoid hanging on mjit_wait with a JIT failure
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mjit.c b/mjit.c
index 53e0cea323..2d9efa3073 100644
--- a/mjit.c
+++ b/mjit.c
@@ -1387,8 +1387,13 @@ static void
mjit_wait(struct rb_iseq_constant_body *body)
{
pid_t initial_pid = current_cc_pid;
- struct timeval tv;
+ if (initial_pid == 0) {
+ mjit_warning("initial_pid was 0 on mjit_wait");
+ return;
+ }
+
int tries = 0;
+ struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 1000;
while (body == NULL ? current_cc_pid == initial_pid : body->jit_func == (jit_func_t)NOT_READY_JIT_ISEQ_FUNC) { // TODO: refactor this