BSD-3-Clause licensed by Mitchell Rosen
Maintained by Mitchell Rosen
This version can be pinned in stack with:timer-wheel-0.2.0@sha256:1d090b0dc82ffe7a5a9d83bbdd627fc0d846a44b3df05205b308d37a1b3579e5,2649

Module documentation for 0.2.0

This library provides a timer wheel data structure for

  • O(1) registering IO actions to fire after a given amount of time

  • O(1) canceling registered actions

It is similar to TimerManager from GHC.Event, but can scale much better under concurrent access patterns.

An unreleased version of this library has a backpack-based signature for selecting from a variety of different data structures used internally. However, until backpack has broader support on Hackage, and in Haddocks, etc, I decided to just hard-code something decent (a priority search queue). This makes the O(1) claims above a bit of a lie, as these rely on using a linked list data structure internally.

Changes

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to the Haskell Package Versioning Policy.

Unreleased

Added

  • destroy function, for reaping the background thread
  • recurring_ function

Changed

  • If the timer wheel reaper thread crashes, it will propagate the exception to the thread that spawned it
  • new may now throw InvalidTimerWheelConfig
  • The cancel action returned by register is now memoized, which fixes a bug involving trying to cancel a recurring timer twice. The second call used to spin forever and peg a CPU
  • Use Config type for creating a timer wheel
  • Change argument order around
  • Rename new to create
  • Make recurring timers more accurate

[0.1.0] - 2018-07-18

Added

  • Initial release