Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,246
    • Issues 5,246
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 574
    • Merge requests 574
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7216
Closed
Open
Issue created Sep 04, 2012 by AndreasVoellmy@trac-AndreasVoellmy

Compositional blocking on file descriptors

The GHC.Event.Thread module provides threadWaitRead, threadWaitWrite :: Fd -> IO () calls that block until a particular file descriptor is ready for reading or writing. With this API a single thread cannot wait on multiple file descriptors or a file descriptor and some other condition (e.g. an MVar, STM transaction, etc). One could work around this by creating extra producer threads that each monitor one file descriptor and then multiplex messages from those threads onto a single channel (or mvar, etc) and then have a consumer thread that waits on this single multiplexed channel. Unfortunately, this extra indirection imposes a modest performance penalty in the form of longer wait times to service events due to having to switch between multiple threads to handle a single ready file.

I propose to provide analogous functions in the STM monad threadWaitReadSTM,threadWaitWriteSTM :: Fd -> STM (). These will allow a single thread to wait on multiple files or both files and other conditions. This eliminates the switching between threads to service a request.

Trac metadata
Trac field Value
Version 7.4.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking