| Copyright | (C) 2026 Edward Kmett |
|---|---|
| License | UPL-1.0 AND BSD-3-Clause |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | GHC FFI; THC runtime services or native fallback implementation |
| Safe Haskell | Safe |
| Language | Haskell2010 |
THC
Description
Small, stable runtime facade. Detailed services are in THC.Thread,
THC.Memory, THC.GC and THC.Trace. Hazardous/internal controls are not
re-exported; THC.Internal.JIT must be imported explicitly.
Synopsis
- module THC.Runtime
- data CpuAffinitySupport
- cpuAffinitySupport :: IO CpuAffinitySupport
- affinityApplied :: IO Bool
- forkOnWithAffinity :: Int -> (Bool -> IO ()) -> IO ThreadId
Documentation
module THC.Runtime
data CpuAffinitySupport Source #
Strength of the runtime's affinity mechanism. Even pinned support does not prove that a particular thread's request was accepted.
Constructors
| NoCpuAffinity | |
| AdvisoryCpuAffinity | |
| PinnedCpuAffinity |
Instances
| Eq CpuAffinitySupport # | |
Defined in THC.Thread Methods (==) :: CpuAffinitySupport -> CpuAffinitySupport -> Bool # (/=) :: CpuAffinitySupport -> CpuAffinitySupport -> Bool # | |
| Ord CpuAffinitySupport # | |
Defined in THC.Thread Methods compare :: CpuAffinitySupport -> CpuAffinitySupport -> Ordering # (<) :: CpuAffinitySupport -> CpuAffinitySupport -> Bool # (<=) :: CpuAffinitySupport -> CpuAffinitySupport -> Bool # (>) :: CpuAffinitySupport -> CpuAffinitySupport -> Bool # (>=) :: CpuAffinitySupport -> CpuAffinitySupport -> Bool # max :: CpuAffinitySupport -> CpuAffinitySupport -> CpuAffinitySupport # min :: CpuAffinitySupport -> CpuAffinitySupport -> CpuAffinitySupport # | |
| Show CpuAffinitySupport # | |
Defined in THC.Thread Methods showsPrec :: Int -> CpuAffinitySupport -> ShowS # show :: CpuAffinitySupport -> String # showList :: [CpuAffinitySupport] -> ShowS # | |
cpuAffinitySupport :: IO CpuAffinitySupport Source #
Compatibility query preserving the original API. Native GHC returns
NoCpuAffinity: ordinary GHC forkOn promises a capability, not a physical
CPU. This does not inspect +RTS -qa. For detailed failure status, inspect
threadAffinitySupport in currentThreadInfo.
affinityApplied :: IO Bool Source #
Did this registered THC fork's initial native request succeed? False also covers unavailable support or no request. Acceptance is not a bound-thread TLS guarantee, nor a promise against subsequent OS policy changes.
forkOnWithAffinity :: Int -> (Bool -> IO ()) -> IO ThreadId Source #
Like forkOn, with the child's initial native-affinity acceptance. The
callback always runs, including unavailable/rejected affinity. Preserves lazy
action evaluation and inherited masking. The integer is a capability index,
not an OS CPU ID; advisory acceptance remains advisory.