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

Fix luv signals (issue #400) #412

Merged
merged 1 commit into from
Jan 24, 2023
Merged

Commits on Jan 24, 2023

  1. Fix luv signals (issue ocaml-multicore#400)

    This makes sure we can process signals in luv the same way we do in uring. As
    stated in ocaml-multicore#400 the main issue is that luv's mainloop will restart on EINTR and
    we will never unwind back to ocaml land, so even though the process got the
    signal, the runtime will not see it until something else goes on.
    
    The trick here is to abuse POSIX thread semantics and shove all signals into one
    specific systhread by blocking them in the other threads.
    
    Additionally, I've fixed a bug in OCaml 5.0 where the systhreads end up starting
    with all signals blocked: ocaml/ocaml#11880. This PR
    works even with/without the bug.
    
    Danger Zone
    ~~~~~~~~~~~
    This is tricky ! If you're thinking we can do better than pipes, think again !
    Unix.sigsuspend doesn't work on multithreaded, we don't have a real Unix.pause
    (it's implemented on top of sigsuspend !).
    The semantics for kill(2) to "self" are different than "from outside" when
    multithreaded, and the runtime doesn't expose pthread_kill(2). That's why on the
    test we have to fork and signal back to the parent. I know, it's horrible.
    
    Co-authored-by: Thomas Leonard <[email protected]>
    haesbaert and talex5 committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    aa1a5c3 View commit details
    Browse the repository at this point in the history