diff --git a/include/reactor-uc/macros.h b/include/reactor-uc/macros.h index 28dc9728..a498dcf6 100644 --- a/include/reactor-uc/macros.h +++ b/include/reactor-uc/macros.h @@ -461,7 +461,7 @@ typedef struct FederatedInputConnection FederatedInputConnection; DynamicScheduler_ctor(&scheduler, &env); \ Environment_ctor(&env, &scheduler.scheduler, (Reactor *)&main_reactor); \ MainReactorName##_ctor(&main_reactor, NULL, &env); \ - env.scheduler->set_duration(env.scheduler, Timeout); \ + env.scheduler->duration = Timeout; \ env.scheduler->keep_alive = KeepAlive; \ env.assemble(&env); \ env.start(&env); \ diff --git a/include/reactor-uc/scheduler.h b/include/reactor-uc/scheduler.h index 51a321ea..f721548b 100644 --- a/include/reactor-uc/scheduler.h +++ b/include/reactor-uc/scheduler.h @@ -64,7 +64,7 @@ struct Scheduler { void (*acquire_and_schedule_start_tag)(Scheduler *self); - void (*set_duration)(Scheduler *self, interval_t duration); + // void (*set_duration)(Scheduler *self, interval_t duration); lf_ret_t (*add_to_reaction_queue)(Scheduler *self, Reaction *reaction); diff --git a/include/reactor-uc/schedulers/dynamic/scheduler.h b/include/reactor-uc/schedulers/dynamic/scheduler.h index 1c87a4e8..baf14503 100644 --- a/include/reactor-uc/schedulers/dynamic/scheduler.h +++ b/include/reactor-uc/schedulers/dynamic/scheduler.h @@ -20,8 +20,7 @@ struct DynamicScheduler { // that are registered for cleanup at the end of the current tag. Trigger *cleanup_ll_head; Trigger *cleanup_ll_tail; - bool leader; // Whether this scheduler is the leader in a federated program and selects the start tag. - // instant_t start_time; // The physical time at which the program started. + bool leader; // Whether this scheduler is the leader in a federated program and selects the start tag. tag_t stop_tag; // The tag at which the program should stop. This is set by the user or by the scheduler. tag_t current_tag; // The current logical tag. Set by the scheduler and read by user in the reaction bodies. }; diff --git a/include/reactor-uc/schedulers/static/scheduler.h b/include/reactor-uc/schedulers/static/scheduler.h index 4d267f34..4f0c5849 100644 --- a/include/reactor-uc/schedulers/static/scheduler.h +++ b/include/reactor-uc/schedulers/static/scheduler.h @@ -18,6 +18,6 @@ struct StaticScheduler { size_t *pc; }; -void StaticScheduler_ctor(StaticScheduler *self, Environment *env); +void StaticScheduler_ctor(StaticScheduler *self, Environment *env, const inst_t **static_schedule); #endif // STATIC_SCHEDULER_H diff --git a/src/schedulers/dynamic/dynamic.c b/src/schedulers/dynamic/dynamic.c index 0bccac9f..1f18688e 100644 --- a/src/schedulers/dynamic/dynamic.c +++ b/src/schedulers/dynamic/dynamic.c @@ -369,7 +369,7 @@ void DynamicScheduler_ctor(DynamicScheduler *self, Environment *env) { self->scheduler.register_for_cleanup = Scheduler_register_for_cleanup; self->scheduler.request_shutdown = Scheduler_request_shutdown; self->scheduler.acquire_and_schedule_start_tag = Scheduler_acquire_and_schedule_start_tag; - self->scheduler.set_duration = Scheduler_set_duration; + // self->scheduler.set_duration = Scheduler_set_duration; self->scheduler.add_to_reaction_queue = Scheduler_add_to_reaction_queue; self->scheduler.current_tag = Scheduler_current_tag; diff --git a/src/schedulers/static/scheduler.c b/src/schedulers/static/scheduler.c index b92043cb..40c94fc4 100644 --- a/src/schedulers/static/scheduler.c +++ b/src/schedulers/static/scheduler.c @@ -35,8 +35,9 @@ Reaction *lf_sched_get_ready_reaction(StaticScheduler *scheduler, int worker_num return returned_reaction; } -void StaticScheduler_ctor(StaticScheduler *self, Environment *env) { +void StaticScheduler_ctor(StaticScheduler *self, Environment *env, const inst_t **static_schedule) { self->env = env; + self->static_schedule = static_schedule; /* self->keep_alive = false; @@ -59,6 +60,9 @@ void StaticScheduler_ctor(StaticScheduler *self, Environment *env) { self->scheduler->register_for_cleanup = Scheduler_register_for_cleanup; self->scheduler->request_shutdown = Scheduler_request_shutdown; self->scheduler->acquire_and_schedule_start_tag = Scheduler_acquire_and_schedule_start_tag; + // self->scheduler.set_duration = Scheduler_set_duration; + // self->scheduler.add_to_reaction_queue = Scheduler_add_to_reaction_queue; + // self->scheduler.current_tag = Scheduler_current_tag; Scheduler_ctor(self->scheduler); } diff --git a/test/unit/action_lib.h b/test/unit/action_lib.h index fd19aff5..819f0b83 100644 --- a/test/unit/action_lib.h +++ b/test/unit/action_lib.h @@ -59,7 +59,7 @@ void action_lib_start(interval_t duration) { DynamicScheduler_ctor(&scheduler, &env); Environment_ctor(&env, &scheduler.scheduler, (Reactor *)&my_reactor); ActionLib_ctor(&my_reactor, NULL, &env); - env.scheduler->set_duration(env.scheduler, duration); + env.scheduler->duration = duration; env.assemble(&env); env.start(&env); Environment_free(&env); diff --git a/test/unit/delayed_conn_test.c b/test/unit/delayed_conn_test.c index 339c209e..6e91506b 100644 --- a/test/unit/delayed_conn_test.c +++ b/test/unit/delayed_conn_test.c @@ -104,7 +104,7 @@ void test_simple() { DynamicScheduler_ctor(&scheduler, &env); Environment_ctor(&env, &scheduler.scheduler ,(Reactor *)&main); Main_ctor(&main, NULL, &env); - env.scheduler->set_duration(env.scheduler, MSEC(100)); + env.scheduler->duration = MSEC(100); env.assemble(&env); env.start(&env); Environment_free(&env); diff --git a/test/unit/physical_action_test.c b/test/unit/physical_action_test.c index 9faba47d..2916f0d0 100644 --- a/test/unit/physical_action_test.c +++ b/test/unit/physical_action_test.c @@ -95,7 +95,7 @@ void test_simple() { DynamicScheduler_ctor(&scheduler, &env); Environment_ctor(&env, &scheduler.scheduler ,(Reactor *)&my_reactor); PhyActionTest_ctor(&my_reactor, NULL, &env); - env.scheduler->set_duration(env.scheduler, MSEC(100)); + env.scheduler->duration = MSEC(100); env.assemble(&env); env.start(&env); Environment_free(&env); diff --git a/test/unit/port_test.c b/test/unit/port_test.c index de195790..2f0ba282 100644 --- a/test/unit/port_test.c +++ b/test/unit/port_test.c @@ -103,7 +103,7 @@ void test_simple() { DynamicScheduler_ctor(&scheduler, &env); Environment_ctor(&env, &scheduler.scheduler, (Reactor *)&main); Main_ctor(&main, NULL, &env); - env.scheduler->set_duration(env.scheduler, MSEC(100)); + env.scheduler->duration = MSEC(100); env.assemble(&env); env.start(&env); Environment_free(&env); diff --git a/test/unit/timer_test.c b/test/unit/timer_test.c index c3114845..c02ab421 100644 --- a/test/unit/timer_test.c +++ b/test/unit/timer_test.c @@ -38,7 +38,7 @@ void test_simple() { DynamicScheduler scheduler; DynamicScheduler_ctor(&scheduler, &env); Environment_ctor(&env, &scheduler.scheduler, (Reactor *)&my_reactor); - env.scheduler->set_duration(env.scheduler, MSEC(100)); + env.scheduler->duration = MSEC(100); TimerTest_ctor(&my_reactor, NULL, &env); env.assemble(&env); env.start(&env);