Module thread

Source
Expand description

Utility methods to spawn a number of scoped threads equals to the number of cores on the machine. Unlike normal threads, scoped threads can borrow data from their environment.

Structsยง

CachePadding
Intentionally force alignment to 128 bytes to make a best effort attempt to place each atomic on its own cache line. This reduces contention and improves performance for common CPU caching protocols such as MESI.
ParIter

Functionsยง

pack ๐Ÿ”’
spawn
Spawn n scoped threads, where n is the available parallelism.
spawn_parallel_iterator
Spawns n scoped threads that each receive a work stealing iterator. Work stealing is an efficient strategy that keeps each CPU core busy when some items take longer than other to process, used by popular libraries such as rayon. Processing at different rates also happens on many modern CPUs with heterogeneous performance and efficiency cores.
threads ๐Ÿ”’
unpack ๐Ÿ”’