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

doTick: use exception-safe modifyMVar_ instead of takeMVar/putMVar #1100

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

ahihi
Copy link
Contributor

@ahihi ahihi commented Nov 5, 2024

fixes #1099, maybe.

disclaimer: i dont fully understand the logic of manipulating stateMV in doTick (and the other locations that touch this MVar)... at the beginning the value is taken out, and if everything runs successfully, a new value is put in. the exception handler doesnt touch stateMV, so it seems like any exception should leave it empty. yet i dont see the hang with all mini-notation syntax errors - for example, Tidal recovers just fine from d1 $ n "<0 1 2§>*16" # s "808". not sure how.

but i am making a guess that the intent here is not to leave stateMV empty on error. to this end, i replaced the takeMVar/putMVar sequence with a modifyMVar_. from my testing so far, this seems to resolve the issue, but im not sure if there might be some undesired side effects.

(i also moved the exception handler into its own function, as i found the previous parenthesized multi-line blocks difficult to read, but let me know if that style is preferred)

@yaxu yaxu merged commit 2270d9e into tidalcycles:dev Nov 8, 2024
18 of 21 checks passed
@yaxu
Copy link
Member

yaxu commented Nov 8, 2024

Thanks, lets merge for now and try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mini-notation syntax error causes stream to freeze
2 participants