rts: Fix a deadlock with eventlog flush interval and RTS shutdown

The ghc_ticker thread attempts to flush at the eventlog tick interval, this requires waiting to take all capabilities.

At the same time, the main thread is shutting down, the schedule is stopped and then we wait for the ticker thread to finish.

Therefore we are deadlocked.

The solution is to use newBoundTask/exitMyTask, so that flushing can cooperate with the scheduler shutdown.

Fixes #26573

Edited by Matthew Pickering

Merge request reports

Loading