diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-09-24 16:51:51 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-09-24 18:47:13 +0300 |
| commit | fecb86f6093c1e8aed6ab05c29c5af9d0cb93157 (patch) | |
| tree | 10171c839d77167fc98fbae0b315d2c87aa13fa5 /src/clock_domain.c | |
| parent | b1d67364b4b4832b8efed112f7b0ead1a0b3cd3b (diff) | |
| download | gran-fecb86f6093c1e8aed6ab05c29c5af9d0cb93157.tar.gz gran-fecb86f6093c1e8aed6ab05c29c5af9d0cb93157.zip | |
initial work towards message passing interface
+ As they are currently implemented, grid *may* get stuck if two nodes
try to send to eachother at the same time, I should probably add in
some kind of input buffer as well
Diffstat (limited to 'src/clock_domain.c')
| -rw-r--r-- | src/clock_domain.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/clock_domain.c b/src/clock_domain.c index 6610d8f..74f0f03 100644 --- a/src/clock_domain.c +++ b/src/clock_domain.c @@ -20,8 +20,6 @@ struct clock_domain { tick period; stat ret; - - mtx_t mtx; }; void advance_clock(struct clock_domain *clk) @@ -41,7 +39,6 @@ struct clock_domain *create_clock_domain(tick period) return NULL; clk->period = period; - mtx_init(&clk->mtx, mtx_plain); clk->components = vec_create(sizeof(struct component *)); return clk; @@ -62,20 +59,12 @@ stat clock_domain_add(struct clock_domain *clk, struct component *component) return OK; } -static void update_ret(struct clock_domain *clk, stat ret) -{ - if (ret) { - mtx_lock(&clk->mtx); - clk->ret = ret; - mtx_unlock(&clk->mtx); - } -} - static void clocked_component_tick(struct clock_domain *clk, struct component *component) { - stat ret = component->clock(component); - update_ret(clk, ret); + stat r = component->clock(component); + if (r) + clk->ret = r; } stat clock_domain_tick(struct clock_domain *clk) |
