Skip to content

Structured Concurrency

Compare
Choose a tag to compare
@istathar istathar released this 03 Oct 13:23
· 179 commits to main since this release
82bbd2b

Structured Concurrency

In this release we have dramatically simplified and improved the internal implementation of concurrency, removing a number of long standing defects arising from inconsistencies in async. Significant thanks are owed to the team behind ki for introducing a very powerful structured concurrency model. For our purposes, bi-directional exception propagation has been our goal and we've landed it using a simplified version of their approach.

In the case where you have waitThreaded for a forked child you will now get the expected behaviour of both the child passing the exception . Here we define a "scope" as a simple Set of ThreadIds whose only purpose is to be able to cancel (kill) them if/when the scope exits. You can enter a new scope with the new createScope function. We now have the correct behaviour when racing threads together, when using ^C to interrupt the program, and when a scope containing threads exits: an exception leaving the scope will cause the scope to kill its child threads. You can wait for a single thread or a list of threads (assuming they have the same return type). The helper functions for running two threads to completion or racing two threads now work in the face of either alternative having forked child threads.

This change requires a major API version bump due to the change to the internal representation (and so a change to the return type of internal function unThread), deprecation of the linkThread function, and overall changes of behaviour. The major version is now core-program 0.6.

Robustness improvements for telemetry

Considerable work has been done in recent months to increase the robustness and polish of the observability implementation used to send telemetry to Honeycomb.

Formatting and parsing of external data

New adapter class Externalize used to get data in and out of canonical external textual representations.

Bug fixes and general improvements

New Contributors

Full Changelog: core-program-0.5.0.2...core-program-0.6.0.1