Skip to content

Commit

Permalink
Partial code-review (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj authored Oct 16, 2024
1 parent d8fa42b commit 4c3c0da
Show file tree
Hide file tree
Showing 34 changed files with 329 additions and 641 deletions.
14 changes: 7 additions & 7 deletions examples/posix/testing_fed_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ void *main_sender(void *unused) {
(void)unused;
Environment_ctor(&env_send, (Reactor *)&sender);
MainSender_ctor(&sender, &env_send);
env_send.set_timeout(&env_send, SEC(1));
env_send.net_channel_size = 1;
env_send.net_channels = (NetworkChannel **)&sender.net_channel;
env_send.scheduler.set_timeout(&env_send.scheduler, SEC(1));
env_send.net_bundles_size = 1;
env_send.net_bundles = (FederatedConnectionBundle **)&sender.bundle;
env_send.assemble(&env_send);
env_send.start(&env_send);
return NULL;
Expand All @@ -249,11 +249,11 @@ void *main_recv(void *unused) {
Environment_ctor(&env_recv, (Reactor *)&receiver);
env_recv.platform->enter_critical_section(env_recv.platform);
MainRecv_ctor(&receiver, &env_recv);
env_recv.set_timeout(&env_recv, SEC(1));
env_recv.keep_alive = true;
env_recv.scheduler.set_timeout(&env_recv.scheduler, SEC(1));
env_recv.scheduler.keep_alive = true;
env_recv.has_async_events = true;
env_recv.net_channel_size = 1;
env_recv.net_channels = (NetworkChannel **)&receiver.net_channels;
env_recv.net_bundles_size = 1;
env_recv.net_bundles = (FederatedConnectionBundle **)&receiver.bundle;
env_recv.assemble(&env_recv);
env_recv.platform->leave_critical_section(env_recv.platform);
env_recv.start(&env_recv);
Expand Down
5 changes: 3 additions & 2 deletions examples/posix/timer_ex.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ struct MyReactor {
};

void reaction_0_body(struct MyReactor *self, MyTimer *my_timer) {
printf("Hello World @ %ld\n", self->super.env->current_tag.time);
Environment *env = self->super.env;
printf("Hello World @ %ld\n", env->get_elapsed_physical_time(env));
}

void reaction_0_wrapper(Reaction *_self) {
Expand All @@ -45,7 +46,7 @@ int main() {
struct MyReactor my_reactor;
Environment env;
Environment_ctor(&env, (Reactor *)&my_reactor);
env.set_timeout(&env, SEC(1));
env.scheduler.set_timeout(&env.scheduler, SEC(1));
MyReactor_ctor(&my_reactor, &env);
env.assemble(&env);
env.start(&env);
Expand Down
300 changes: 0 additions & 300 deletions examples/zephyr/federated/src/testing_fed_conn.c

This file was deleted.

14 changes: 7 additions & 7 deletions include/reactor-uc/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ typedef struct LogicalAction LogicalAction;
typedef struct PhysicalAction PhysicalAction;

struct Action {
Trigger super; // Inherit from Trigger
interval_t min_offset; // The minimum offset from the current time that an event can be scheduled on this action.
interval_t min_spacing; // The minimum spacing between two consecutive events on this action.
tag_t previous_event; // Used to enforce min_spacing
TriggerEffects effects; // The reactions triggered by this Action.
TriggerSources sources; // The reactions that can write to this Action.
TriggerValue trigger_value; // FIFO storage of the data associated with the events scheduled on this action.
Trigger super; // Inherit from Trigger
interval_t min_offset; // The minimum offset from the current time that an event can be scheduled on this action.
interval_t min_spacing; // The minimum spacing between two consecutive events on this action.
tag_t previous_event; // Used to enforce min_spacing
TriggerEffects effects; // The reactions triggered by this Action.
TriggerSources sources; // The reactions that can write to this Action.
TriggerDataQueue trigger_data_queue; // FIFO storage of the data associated with the events scheduled on this action.
/**
* @brief Schedule an event on this action.
*/
Expand Down
Loading

0 comments on commit 4c3c0da

Please sign in to comment.