ki

A lightweight structured concurrency library

https://github.com/awkward-squad/ki

Version on this page:1.0.0.2
LTS Haskell 22.18:1.0.1.1
Stackage Nightly 2024-04-25:1.0.1.1
Latest on Hackage:1.0.1.1

See all snapshots ki appears in

BSD-3-Clause licensed by Mitchell Rosen
This version can be pinned in stack with:ki-1.0.0.2@sha256:2ecbd18cac105fe12ea2ffab5705e0dade3fe437bcce2a7d3be948805a43c0f0,2585

Module documentation for 1.0.0.2

Depends on 2 packages(full list with versions):
Used by 3 packages in lts-20.12(full list with versions):
ki ki-unlifted
GitHub CI
Hackage Hackage
Stackage LTS Stackage LTS
Stackage Nightly Stackage Nightly
Dependencies Dependencies

Overview

ki is a lightweight structured-concurrency library inspired by many other projects and blog posts:

A previous version of ki also included a mechanism for soft-cancellation/graceful shutdown, which took inspiration from:

However, this feature was removed (perhaps temporarily) because the design of the API was unsatisfactory.

Documentation

Hackage documentation

Changes

[1.0.0.2] - 2023-01-25

  • Bugfix #20: previously, a child thread could deadlock when attempting to propagate an exception to its parent

[1.0.0.1] - 2022-08-14

  • Compat: support GHC 9.4.1

[1.0.0] - 2022-06-30

  • Breaking: Remove Context type, Ki.Implicit module, and the ability to soft-cancel a Scope.

  • Breaking: Remove Duration type and its associated API, including waitFor and awaitFor.

  • Breaking: Remove Ki.Internal module.

  • Breaking: Generalize async to forkTry.

  • Breaking: Generalize forkWithUnmask to forkWith.

  • Breaking: Make fork_ take an IO Void rather than an IO ().

  • Breaking: Make fork create an unmasked thread, rather than inherit the parent’s masking state.

  • Breaking: Rename waitSTM to awaitAll (replacing the old wait in IO).

  • Change: Make scoped kill threads in the order they were created.

  • Bugfix: Fix small memory leak related to closing a scope.

  • Bugfix: Fix subtle bug related to GHC’s treatment of deadlocked threads.

  • Bugfix: make async (now forkTry) propagate async exceptions.

  • Bugfix: make scoped safe to run with asynchronous exceptions masked.

  • Bugfix: propagate exceptions to creator of scope, not creator of thread

  • Performance: Use atomic fetch-and-add rather than a TVar to track internal child thread ids.

[0.2.0] - 2020-12-17

  • Breaking: Remove ThreadFailed exception wrapper.
  • Breaking: Rename cancelScope to cancel.

[0.1.0.1] - 2020-11-30

  • Misc: Replace AtomicCounter with Int to drop the atomic-primops dependency.

  • Bounds: Lower cabal-version from 3.0 to 2.2 because stack cannot parse 3.0.

[0.1.0] - 2020-11-11

  • Initial release.