From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 14/25] vinyl: zap vy_scheduler::is_worker_pool_running Date: Fri, 27 Jul 2018 14:29:54 +0300 Message-Id: <3d95c469702a9dcb8e9f41f732739614b786c15c.1532689066.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: This flag is set iff worker_pool != NULL hence it is pointless. --- src/box/vy_scheduler.c | 9 +++------ src/box/vy_scheduler.h | 2 -- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c index 4813f6f4..5752ae91 100644 --- a/src/box/vy_scheduler.c +++ b/src/box/vy_scheduler.c @@ -274,11 +274,10 @@ vy_compact_heap_less(struct heap_node *a, struct heap_node *b) static void vy_scheduler_start_workers(struct vy_scheduler *scheduler) { - assert(!scheduler->is_worker_pool_running); + assert(scheduler->worker_pool == NULL); /* One thread is reserved for dumps, see vy_schedule(). */ assert(scheduler->worker_pool_size >= 2); - scheduler->is_worker_pool_running = true; scheduler->idle_worker_count = scheduler->worker_pool_size; scheduler->worker_pool = calloc(scheduler->worker_pool_size, sizeof(*scheduler->worker_pool)); @@ -300,9 +299,7 @@ vy_scheduler_start_workers(struct vy_scheduler *scheduler) static void vy_scheduler_stop_workers(struct vy_scheduler *scheduler) { - assert(scheduler->is_worker_pool_running); - scheduler->is_worker_pool_running = false; - + assert(scheduler->worker_pool != NULL); for (int i = 0; i < scheduler->worker_pool_size; i++) { struct vy_worker *worker = &scheduler->worker_pool[i]; cbus_stop_loop(&worker->worker_pipe); @@ -355,7 +352,7 @@ vy_scheduler_destroy(struct vy_scheduler *scheduler) fiber_cond_signal(&scheduler->dump_cond); fiber_cond_signal(&scheduler->scheduler_cond); - if (scheduler->is_worker_pool_running) + if (scheduler->worker_pool != NULL) vy_scheduler_stop_workers(scheduler); diag_destroy(&scheduler->diag); diff --git a/src/box/vy_scheduler.h b/src/box/vy_scheduler.h index a235aa6f..deefacd7 100644 --- a/src/box/vy_scheduler.h +++ b/src/box/vy_scheduler.h @@ -67,8 +67,6 @@ struct vy_scheduler { * dump/compaction tasks. */ struct vy_worker *worker_pool; - /** Set if the worker threads are running. */ - bool is_worker_pool_running; /** Total number of worker threads. */ int worker_pool_size; /** Number worker threads that are currently idle. */ -- 2.11.0