Skip to content

Commit

Permalink
fixing macros and scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Nov 19, 2024
1 parent b1c57ed commit 4f59741
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/reactor-uc/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down
2 changes: 1 addition & 1 deletion include/reactor-uc/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions include/reactor-uc/schedulers/dynamic/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};
Expand Down
2 changes: 1 addition & 1 deletion include/reactor-uc/schedulers/static/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/schedulers/dynamic/dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion src/schedulers/static/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
2 changes: 1 addition & 1 deletion test/unit/action_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/delayed_conn_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/physical_action_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/port_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/timer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4f59741

Please sign in to comment.