Readme tweaks

This commit is contained in:
Mitchell Rosen 2020-05-14 19:28:30 -04:00 committed by GitHub
parent dcb40f82ad
commit d66944790a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,8 @@
`ki` is a lightweight structured-concurrency library inspired by
[libdill](http://libdill.org/), [trio](https://github.com/python-trio/trio),
and [golang.org/pkg/context](https://golang.org/pkg/context/).
[`libdill`](http://libdill.org/), [`trio`](https://github.com/python-trio/trio),
and [`golang.org/pkg/context`](https://golang.org/pkg/context/).
The primary abstraction is the *scope*, which delimits the lifetime of *threads*
The primary abstraction is the **scope**, which delimits the lifetime of **threads**
forked within it.
```haskell
@ -27,11 +27,11 @@ Ki.scoped context \scope -> do
Ki.wait scope
```
A *scope* can be hard-cancelled: when the callback provided to `scoped` returns,
all remaining *threads* forked within it are killed. By the time `scoped` itself
A **scope** can be hard-cancelled. When the callback provided to `scoped` returns,
all remaining **threads** forked within it are killed. By the time `scoped` itself
returns, they're guaranteed to have finished.
A *scope* can be soft-cancelled, too, but it requires cooperation. A *thread*
A **scope** can be soft-cancelled, too, but it requires cooperation. A **thread**
can observe whether it's meant to gracefully terminate, but it may never notice,
or ignore the suggestion.
@ -52,9 +52,9 @@ Ki.scoped context \scope -> do
Ki.waitFor scope 1000000
```
Soft-cancellation is hierarchical: it is observable by all *threads* forked
within a *scope*, all *threads* _forked by_ them, and so on.
Soft-cancellation is hierarchical. It is observable by all **threads** forked
within a **scope**, all **threads** _forked by_ them, and so on.
The implementation is tested for deadlocks, race conditions, and other
concurrency anomalies by [dejafu](http://hackage.haskell.org/package/dejafu), a
concurrency anomalies by [`dejafu`](http://hackage.haskell.org/package/dejafu), a
fantastic unit-testing library for concurrent programs.