lwt icon indicating copy to clipboard operation
lwt copied to clipboard

Add Lwt_preemptive.run_in_main_no_wait

Open kit-ty-kate opened this issue 2 years ago • 2 comments

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 avatar Sep 02 '22 18:09 kit-ty-kate

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.

kit-ty-kate avatar Sep 02 '22 18:09 kit-ty-kate

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 avatar Sep 05 '22 14:09 raphael-proust

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 avatar Oct 27 '22 09:10 raphael-proust

I implemented the two things I mention above and also rebased

raphael-proust avatar Feb 02 '23 16:02 raphael-proust

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

raphael-proust avatar Feb 02 '23 17:02 raphael-proust

Looks good by me.

kit-ty-kate avatar Feb 07 '23 14:02 kit-ty-kate