From 0dc50688926fbd424cfa75f436fc1d59b479a1e1 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Wed, 6 Jun 2018 14:36:56 +0000 Subject: mjit.c: unify wording between comments and variables Some comments say "stop", others say "finish". I'm going to add code which dynamically stops MJIT worker, rather than finishing it forever. So I'm thinking `stop` is more appropreate for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mjit.c b/mjit.c index 7938751bc7..c6d7cbbdf1 100644 --- a/mjit.c +++ b/mjit.c @@ -913,10 +913,10 @@ convert_unit_to_func(struct rb_mjit_unit *unit) return (mjit_func_t)func; } -/* Set to TRUE to finish worker. */ -static int finish_worker_p; -/* Set to TRUE if worker is finished. */ -static int worker_finished; +/* Set to TRUE to stop worker. */ +static int stop_worker_p; +/* Set to TRUE if worker is stopped. */ +static int worker_stopped; /* The function implementing a worker. It is executed in a separate thread by rb_thread_create_mjit_thread. It compiles precompiled header @@ -927,21 +927,21 @@ worker(void) make_pch(); if (pch_status == PCH_FAILED) { mjit_init_p = FALSE; - CRITICAL_SECTION_START(3, "in worker to update worker_finished"); - worker_finished = TRUE; + CRITICAL_SECTION_START(3, "in worker to update worker_stopped"); + worker_stopped = TRUE; verbose(3, "Sending wakeup signal to client in a mjit-worker"); rb_native_cond_signal(&mjit_client_wakeup); - CRITICAL_SECTION_FINISH(3, "in worker to update worker_finished"); + CRITICAL_SECTION_FINISH(3, "in worker to update worker_stopped"); return; /* TODO: do the same thing in the latter half of mjit_finish */ } /* main worker loop */ - while (!finish_worker_p) { + while (!stop_worker_p) { struct rb_mjit_unit_node *node; /* wait until unit is available */ CRITICAL_SECTION_START(3, "in worker dequeue"); - while ((unit_queue.head == NULL || active_units.length > mjit_opts.max_cache_size) && !finish_worker_p) { + while ((unit_queue.head == NULL || active_units.length > mjit_opts.max_cache_size) && !stop_worker_p) { rb_native_cond_wait(&mjit_worker_wakeup, &mjit_engine_mutex); verbose(3, "Getting wakeup from client"); } @@ -962,7 +962,7 @@ worker(void) } /* To keep mutex unlocked when it is destroyed by mjit_finish, don't wrap CRITICAL_SECTION here. */ - worker_finished = TRUE; + worker_stopped = TRUE; } /* MJIT info related to an existing continutaion. */ @@ -1421,8 +1421,8 @@ mjit_init(struct mjit_options *opts) rb_define_global_const("RUBY_DESCRIPTION", rb_obj_freeze(rb_description)); /* Initialize worker thread */ - finish_worker_p = FALSE; - worker_finished = FALSE; + stop_worker_p = FALSE; + worker_stopped = FALSE; if (!rb_thread_create_mjit_thread(child_after_fork, worker)) { mjit_init_p = FALSE; rb_native_mutex_destroy(&mjit_engine_mutex); @@ -1458,8 +1458,8 @@ mjit_finish(void) CRITICAL_SECTION_FINISH(3, "in mjit_finish to wakeup from pch"); /* Stop worker */ - finish_worker_p = TRUE; - while (!worker_finished) { + stop_worker_p = TRUE; + while (!worker_stopped) { verbose(3, "Sending cancel signal to workers"); CRITICAL_SECTION_START(3, "in mjit_finish"); rb_native_cond_broadcast(&mjit_worker_wakeup); -- cgit v1.2.3