Concurrent and parallel programs
Use scoped threads for work that borrows local data, or an executor for many owned jobs. Captured jobs use the functions-as-values lessons; generic recovery helpers also use type parameters.
- Import concurrency explicitly
- Run scoped threads
- Borrow local data for a worker
- Count with atomics
- Share mutable state with a mutex
- Choose how workers share state
- Move jobs to workers
- Run stored jobs
- Send values between threads
- Avoid waits that hang
- Handle channel backpressure
- Bound your waits
- Share one deadline across waits
- Reuse workers with an executor
- Handle executor outcomes
- Share state with pool workers
- Cancel queued work and bound a future wait
- Stop work cooperatively
- Recover a job when submission cannot proceed
- Map fallible work in parallel
- Combine values in parallel
- Receive from either channel
- Wait for I/O with a deadline
- Serve a TCP connection
- Encrypt a TCP connection
- Verify clients and choose a protocol
- Serve HTTP requests
- Stop a server on a signal
- Read forms, cookies and forwarded clients
- Serve files and sign cookies
- Send HTTP requests
- Share one HTTP client between workers
- Talk over WebSockets
- Stream events to browsers