-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Release callback early in domain_thread_func #12408
Conversation
The outcome of my review of this PR (which I believe is correct) is that I wrote the following alternative proposal, which allows dynamic allocations and global roots, and I think results in simpler code overall: trunk...gasche:ocaml:domain_spawn_callback_liveness Do you have an opinion about this proposal? |
(I would be fine with merging your changes and then discussing my suggestion as a follow-up PR if you prefer. In that case: did you intentionally not include a Changes entry?) |
I have reviewed your patch, I like it as you are getting rid of global roots entirely. I suspect that formally the reasoning of correctness is trickier but I think it is correct. It's a bit simpler for me if you can rebase it on top of #12409 as there is some diff overlap. Would you mind rebasing it over the latter? Otherwise I don't gain much in discussing it separately from the present PR and thus we could as well include it here. I have added a Changes entry. |
Note: If the answer is that you prefer if I do the rebasing, then I can quickly base the present PR on your suggestion to avoid having another PR. |
I propose to go ahead with the current PR as-is, review #12409 and merge if applicable. Then I can rebase my own PR and we can discuss it. I had done the work of rebasing my patch on top of the present PR, and in the process made a minor change to your comment and variable name. I pushed this change to the current PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge if @gadmm agrees.
Yes, please, thanks. |
caml_callback
is careful not to keep its callback alive for the duration of the call. This allows the closure to be collected as early as possible.Similarly, this change makes sure not to keep the functional argument to
Domain.spawn
alive longer than needed.cc @kayceesrk