Skip to content

SI.MonadDelay.threadDelay behaves differently than in IO for sub-microsecond timeouts #232

@isovector

Description

@isovector

Describe the bug

The SI.MonadDelay.threadDelay instance does the wrong thing for sub-microsecond timeouts.

Consider that SI.MonadDelay.threadDelay is defined over DiffTime, which has picosecond precision. But Control.Concurrent.threadDelay has only microsecond precision.

Behind the scenes, io-sim represents ThreadDelay with a DiffTime and reasons about it as if that were true. But when running the same code against IO, any sub-microsecond delay will round down to 0.

Expected behaviour

The ThreadDelay constructor should probably round any values below 1e-6 down to 0.

Desktop (please complete the following information):

  • GHC version: 9.6.7
  • io-sim version: 1.8.0.1
  • io-classes version: 1.8.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions