-
Notifications
You must be signed in to change notification settings - Fork 8
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
Use Threads.@spawn
instead of @async
#86
base: main
Are you sure you want to change the base?
Conversation
Hey @devmotion, thanks for contributing! I would like to get some feedback on when to use |
I see that you also contributed to PumasAI/QuartoNotebookRunner.jl#192, I think this is a good case that we should also take into account. What is the desired behaviour with RNGs for Malt? |
Based on the docs and PRs such as JuliaLang/julia#55315 I assumed one should always use |
I'm not sure actually, I think it depends on the intended use of Malt. For linear computations such as in QuartoNotebookRunner I think one would expect that state of all objects (including the RNG) is preserved between subsequent calls of I think this discussion is not directly related to this PR though, for that problem it doesn't seem to matter if one uses |
Do you have an example for an object for which it would be problematic if the accessing task is not pinned to a thread anymore? And which |
I initially replied
which is wrong, because it assumes we're on PlutoSliderServer. But also that it's not 100% wrong, because there is the implicit assumption that the handler is pinned on the main thread of the Malt worker on every client that uses Malt. (the exact problem mentioned in JuliaWeb/HTTP.jl#1102 (comment)) User code can escape the main thread by doing |
A very mechanical PR that goes beyond #72 and replaces every occurrence of
@async
withThreads.@spawn
, as recommended in the Julia documentation of@async
:Fixes #71.