Skip to content

Add Lwt_preemptive.run_in_main_no_wait - #960

Merged
raphael-proust merged 6 commits into
ocsigen:masterfrom
kit-ty-kate:run_in_main_no_wait
Mar 3, 2023
Merged

raphael-proust merged 6 commits into
ocsigen:masterfrom
kit-ty-kate:run_in_main_no_wait

Conversation

@kit-ty-kate

Copy link
Copy Markdown
Contributor

Useful if you want Lwt_preemptive.run_in_main but does not need to wait for the result of the function to finish.

@kit-ty-kate

Copy link
Copy Markdown
Contributor Author

Side note: personally i ended up using Lwt_unix.send_notification directly instead of using this function because the extra mutex weren't needed and made it a bit too slow and unpredictable but I feel like it might still be useful for someone someday.

@raphael-proust

Copy link
Copy Markdown
Collaborator

Thanks for the contribution!

I have just quickly read the diff and it looks good. I will test the feature soon and then merge.

@raphael-proust

Copy link
Copy Markdown
Collaborator

Considering the following changes:

  • naming it run_in_main_dont_wait to be consistent with dont_wait
  • adding an exception handler (otherwise exceptions raised by the lambda are lost)

I'll do that soon. Unless anyone have comments/remarks/etc. on the matter?

@raphael-proust

Copy link
Copy Markdown
Collaborator

I implemented the two things I mention above and also rebased

@raphael-proust

Copy link
Copy Markdown
Collaborator

@kit-ty-kate are you ok with the new interface? Does it work for your use-case?

@kit-ty-kate

Copy link
Copy Markdown
Contributor Author

Looks good by me.

@raphael-proust
raphael-proust merged commit cc05e2b into ocsigen:master Mar 3, 2023
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.

2 participants