mirror of
https://github.com/awkward-squad/ki.git
synced 2024-10-03 22:57:51 +03:00
Readme tweaks
This commit is contained in:
parent
dcb40f82ad
commit
d66944790a
18
README.md
18
README.md
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user