From d96483de720f6a54292b15fea2458befa02a3ffa Mon Sep 17 00:00:00 2001 From: k0kubun Date: Mon, 22 Oct 2018 09:53:00 +0000 Subject: [PATCH] mjit_worker.c: return more appropriate result of copy job. When job is being stopped but job is actually finished, returning FALSE could be a little confusing from the function name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit_worker.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/mjit_worker.c b/mjit_worker.c index 637ab1f2a1..b25dc6f190 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -1176,24 +1176,18 @@ static void mjit_copy_job_handler(void *data); static int copy_cache_from_main_thread(struct mjit_copy_job *job) { - int success_p = TRUE; job->finish_p = FALSE; if (!rb_postponed_job_register(0, mjit_copy_job_handler, (void *)job)) return FALSE; CRITICAL_SECTION_START(3, "in MJIT copy job wait"); - while (!job->finish_p) { + while (!job->finish_p && !stop_worker_p) { rb_native_cond_wait(&mjit_worker_wakeup, &mjit_engine_mutex); verbose(3, "Getting wakeup from client"); - - if (stop_worker_p) { /* for cond broadcast from stop_worker() */ - success_p = FALSE; - break; - } } CRITICAL_SECTION_FINISH(3, "in MJIT copy job wait"); - return success_p; + return job->finish_p; } /* The function implementing a worker. It is executed in a separate