purescript-threading/README.md

17 lines
727 B
Markdown
Raw Normal View History

2024-07-16 17:55:45 +00:00
# purescript-threading
Concurrency primitives inspired by python's multithreading and rust, allowing for
predictable concurrency with `Aff`
2024-05-14 16:41:29 +00:00
2024-07-16 17:55:45 +00:00
## Use Cases
* Create a background worker thread
* Communicate between threads (`Threading.Channel`)
* Limit access to a resource _(eg. a database connection pool, file handle)_ to 1 concurrent actor (`Threading.RWLock`, `Threading.Mutex`)
* Coordinate concurrent threads, waiting for some common goal to be reached before continuing (`Threading.Barrier`)
* Create a pool of concurrent "threads" that can pull work from a queue, with graceful exiting and error handling
* Remotely kill a thread, or non-blockingly ask if it has exited
2024-05-14 16:41:29 +00:00
## Installing
```bash
2024-07-16 17:55:45 +00:00
spago install threading
2024-05-22 20:50:30 +00:00
```