haskell / haskell/unix

Drop use of `rtsTimerSignal` on ghc >= 10

Open Beginner friendly
#365 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
124
Forks
99
PR merge metrics
No merged PRs in 30d

Description

The unix package has:
```
--- | A set of signals reserved for use by the implementation. In GHC, this will normally
--- include either `sigVTALRM` or `sigALRM`.
reservedSignals :: SignalSet
reservedSignals = addSignal rtsTimerSignal emptySignalSet

foreign import ccall rtsTimerSignal :: CInt
```

In [MR !15757](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15757) we remove the signal-based timer/ticker implementations. This means that for GHC at least, there are no reserved signals. And the RTS will want to drop its exported function `rtsTimerSignal`, since it is now meaningless. The unix package is its only user (afaics).

Since presumably the unix package wants to support a range of ghc versions, then all we need is a bit of cpp:
```diff
--- | A set of signals reserved for use by the implementation. In GHC, this will normally
--- include either `sigVTALRM` or `sigALRM`.
+-- | A set of signals reserved for use by the implementation. In GHC prior to
+-- version 10, this will normally include either `sigVTALRM` or `sigALRM`.
+-- In GHC 10 it is empty.
reservedSignals :: SignalSet
+#if __GLASGOW_HASKELL__ >= 1000
+reservedSignals = emptySignalSet
+#else
reservedSignals = addSignal rtsTimerSignal emptySignalSet

foreign import ccall rtsTimerSignal :: CInt
+#endif
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the unix package definition of reservedSignals and its rtsTimerSignal foreign import, using the issue’s CPP example as the entry point for GHC-version compatibility. Done means older GHC versions retain the existing signal behavior while GHC 10 and newer produce an empty reserved signal set without using rtsTimerSignal.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
operating-systems
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.