Skip to content

RTS: open timerfd synchronously (#20618)

Sylvain Henry requested to merge hsyl20/ghc:hsyl20/rts-ticker into master

Open the file descriptor for the timer synchronously.

We used to do it in itimer_thread_func (i.e. in the timer thread) but it meant that some user code could run before it and get confused by the allocation of the timerfd.

See hClose002 which unsafely closes a file descriptor twice expecting an exception the second time: it sometimes failed when the second call to "close" closed our own timerfd which inadvertently reused the same file descriptor closed by the first call! (see #20618 (closed))

Merge request reports