Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,248
    • Issues 4,248
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 391
    • Merge Requests 391
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #9519

Closed
Open
Opened Aug 28, 2014 by abbradar@trac-abbradar

Add a way to mask thread preemption via fired timer for a computation

This follows haskell-cafe discussion http://www.haskell.org/pipermail/haskell-cafe/2014-August/115656.html. In brief: some C libraries (for example, SDL) use thread-local variables for error state of the last call. Without some way to temporarily mask timer-based lightweight thread preemption on one OS thread, there is no safe way to use such libraries and retrieve errors aside from using a global MVar (which will block all calls, not just ones on the same OS thread). For "errno" variable from C standard library, this is handled explicitly in RTS by saving its state for each lightweight thread.

So the proposal is: add new prims (something in lines of "maskPreemption#", "unmaskPreemption#" and "getPreemptionState#") which will make a computation not preemptable via fired timer and temporarily attached to one OS thread, and corresponding functions in Control.Concurrent. They should be able to be used together with "Control.Exception.mask" to also block async exceptions, if this is needed.

(I'm sorry if I've misunderstood something or did something the wrong way; I don't know the internal workings of RTS and this is my first GHC bug report).

Trac metadata
Trac field Value
Version 7.8.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC simonmar
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#9519