Skip to content

GitLab

  • Menu
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 4,861
    • Issues 4,861
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • 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 Compiler
  • GHCGHC
  • Issues
  • #16601
Closed
Open
Created Apr 24, 2019 by takano-akio@takano-akioReporter

Precision of `threadDelay` with -threaded could be increased on Linux

Motivation

threadDelay takes a sleep duration as a number of microseconds, but the implementation used on Linux when -theaded is specified uses much coarser precision, leading to surprise.

Current implementation

When using the epoll backend, the timer manager uses the timeout argument to epoll_wait to service threadDelay requests. However, this has only millisecond precision, and it's also round up to the system clock granularity.

Proposed change

The epoll backend maintains a timer fd (created using timerfd_create), and uses it whenever a finite timeout is requested.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking