-
Notifications
You must be signed in to change notification settings - Fork 26
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
An apparent race condition in mainWidget
's shutdown event handling
#84
Comments
Just in case -- the following also terminates. mainWidget $ getPostBuild >>= delay 0 |
Comparing https://github.com/reflex-frp/reflex-vty/blob/develop/src/Reflex/Vty/Host.hs#L157 and https://github.com/reflex-frp/reflex-vty/blob/develop/src/Reflex/Vty/Host.hs#L195 It seems you are right. The postBuild event is being handled before the normal event loop started and that firing does not handle the shutdown event. I don’t know if this should be considered bug. An application which shuts down on postBuild seems a bit useless. 😆 |
@maralorn, what if semantics of the application are to perform conditional immediate termination? I've not looked into the details of how large the race window is -- what amount of computation can be practically done within it -- as well as how dependent is the size of the race window on the parallelism/single-thread performance of the system and the OS/RTS thread scheduling behavior. That said, I do agree it's a rather niche issue. |
Yeah, I admit I had thought about the conditional thing, too. It might make sense in some situations. This is not actually a race condition in the sense of a timing issue. Reflex event propagation is actually pretty deterministic and not concurrent. You could in theory delay this postbuild event with an arbitrarily computationally slow function. Or e.g. with a threadDelay in the executed function. (But not with something using performEvent or the reflex delay function). |
This one does terminate, as expected:
..but neither of the following do:
The text was updated successfully, but these errors were encountered: