#thread #scheduler #scheduling #parallel

topograph

A miniscule thread pool and toposort scheduler

7 releases (4 breaking)

0.4.0 Nov 21, 2024
0.3.1-alpha.1 Jan 11, 2022
0.2.1-alpha.1 Dec 15, 2021
0.2.0-alpha.1 Nov 20, 2021
0.0.0 Nov 19, 2021

#396 in Concurrency

Download history 7/week @ 2024-09-20 3/week @ 2024-09-27 64/week @ 2024-11-15 80/week @ 2024-11-22 15/week @ 2024-11-29 8/week @ 2024-12-06

167 downloads per month
Used in latke

MIT/Apache

67KB
1.5K SLoC

topograph - A tiny thread pool and toposort implementation

No diving allowed!

WARNING: The 0.2.x-alpha* versions use the generic_associated_types feature gate. I apologize.

This is a quick and dirty thread-scheduling library I wrote up for handling non-async jobs in a concurrent queue. For this specific use case, rayon and tokio, which are both fantastic packages, didn't quite do what I wanted.

For more info on this package, check out the docs.


lib.rs:

A tiny library offering a concurrent work queue for synchronous or asynchronous tasks, as well as an implementation of topological sort built on top of it

This crate contains two main components, each with their own (slightly different) use cases:

  • executor contains the core logic for the work queue, as well as the necessary types and logic to initialize it
  • graph is a topological sort implementation for handling more complex cases with inter-task dependencies

The documentation for each of the above modules contains example code for each use case. Common traits used when working with topograph

Dependencies

~1.5–8MB
~65K SLoC