Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure state consistency within a revision #222

Open
anp opened this issue Dec 10, 2020 · 2 comments · May be fixed by #223
Open

Ensure state consistency within a revision #222

anp opened this issue Dec 10, 2020 · 2 comments · May be fixed by #223
Labels
core Related to the core `moxie` crate
Milestone

Comments

@anp
Copy link
Owner

anp commented Dec 10, 2020

Within a single call to run_once, all Vars observed should have the same revision as the current run. If a var is updated by another thread during run_once, the function called by run_once should still see the version of the state which existed at the start of the revision.

@zetanumbers
Copy link
Contributor

I think the solution would be addition of staged commits and stage lock. It feels like an embeded version control system. I would argue the Revision logic should be implemented inside a separate module from the runtime.

@zetanumbers
Copy link
Contributor

zetanumbers commented Dec 12, 2020

Today i have a possible reason why run_once and set_state_change_waker should be abandoned. Our task at the start of run_once is to atomically (all in one motion) increment revision and "lock" the stage_lock with the AtomicCell or whatever. However implementation of RunLoop::poll_next is then rather problematic because of two atomic operations of set_state_change_waker and run_once, introducing a race condition. As I see it, adding Waker to this AtomicCell is unavoidable and existence of run_once alongside with set_state_change_waker is "unsafe".

EDIT: Well maybe i was too unapologetic and adding poll_once (Name subject to change) could do the trick.

zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Dec 14, 2020
@zetanumbers zetanumbers linked a pull request Dec 14, 2020 that will close this issue
4 tasks
zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Dec 29, 2020
zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Jan 3, 2021
zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Jan 5, 2021
@anp anp added the core Related to the core `moxie` crate label Feb 2, 2021
@anp anp added this to the moxie 1.0 milestone Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to the core `moxie` crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants