From 7a9af4e7590e0bc3ab486be46c33e07241645f44 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 12 Mar 2019 17:43:32 +0100 Subject: [PATCH] :art: Move is_running to BBQ --- include/vm.h | 2 +- src/gwion.c | 2 +- src/main.c | 2 +- src/vm/driver.c | 2 +- src/vm/shreduler.c | 2 +- src/vm/vm.c | 2 +- tests/import/driver.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/vm.h b/include/vm.h index 44e057f3..1dde1ad5 100644 --- a/include/vm.h +++ b/include/vm.h @@ -21,6 +21,7 @@ struct BBQ_ { uint32_t sr; // int 32 uint8_t n_in; uint8_t n_out; + volatile uint is_running;// : 1; // => shreduler }; typedef struct Shreduler_* Shreduler; @@ -31,7 +32,6 @@ typedef struct VM_ { struct BBQ_* bbq; struct Gwion_* gwion; uint32_t rand[2]; - volatile unsigned is_running : 1; // => shreduler } VM; typedef struct VM_Shred_* VM_Shred; diff --git a/src/gwion.c b/src/gwion.c index fe2ff00e..df5783f1 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -93,7 +93,7 @@ ANN m_bool gwion_ini(const Gwion gwion, int argc, char** argv) { ANN void gwion_run(const Gwion gwion) { VM* vm = gwion->vm; - vm->is_running = 1; + vm->bbq->is_running = 1; plug_ini(gwion, &gwion->arg->mod); VMBENCH_INI gwion->di->driver->run(vm, gwion->di); diff --git a/src/main.c b/src/main.c index 95f9b74d..3f2bed07 100644 --- a/src/main.c +++ b/src/main.c @@ -9,7 +9,7 @@ static struct Gwion_ gwion; static void sig(int unused __attribute__((unused))) { - gwion.vm->is_running = 0; + gwion.vm->bbq->is_running = 0; } int main(int argc, char** argv) { diff --git a/src/vm/driver.c b/src/vm/driver.c index 22360bbd..c519cd2e 100644 --- a/src/vm/driver.c +++ b/src/vm/driver.c @@ -20,7 +20,7 @@ ANN struct BBQ_* new_bbq(DriverInfo* di) { } static void dummy_run(VM* vm, DriverInfo* di) { - while(vm->is_running) { + while(vm->bbq->is_running) { di->run(vm); ++vm->bbq->pos; } diff --git a/src/vm/shreduler.c b/src/vm/shreduler.c index c9f8df73..865f8457 100644 --- a/src/vm/shreduler.c +++ b/src/vm/shreduler.c @@ -15,7 +15,7 @@ ANN VM_Shred shreduler_get(const Shreduler s) { struct ShredTick_ *tk = s->list; if(!tk) { if(!vector_size(&s->shreds) && !s->loop) - vm->is_running = 0; + vm->bbq->is_running = 0; return NULL; } const m_float time = (m_float)vm->bbq->pos + (m_float).5; diff --git a/src/vm/vm.c b/src/vm/vm.c index 17d0dc47..7c0f77e2 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -760,7 +760,7 @@ timespecsub(&exec_end, &exec_ini, &exec_ret); timespecadd(&exec_time, &exec_ret, &exec_time); #endif } - if(!vm->is_running) { + if(!vm->bbq->is_running) { #ifdef VMBENCH printf("[VM] exec time %lu.%09lu\n", exec_time.tv_sec, exec_time.tv_nsec); printf("[VM] exec time %09lu\n", exec_time.tv_nsec/1000); diff --git a/tests/import/driver.c b/tests/import/driver.c index ec3c447f..9e685f8a 100644 --- a/tests/import/driver.c +++ b/tests/import/driver.c @@ -10,7 +10,7 @@ #include "plug.h" static void dummy_run(VM* vm, DriverInfo* di) { - while(vm->is_running) { + while(vm->bbq->is_running) { di->run(vm); ++vm->bbq->pos; } -- 2.43.0