3 unstable releases

0.2.1 Feb 5, 2025
0.2.0 Feb 5, 2025
0.1.0 Feb 4, 2025

#342 in Concurrency

Download history 299/week @ 2025-01-31 87/week @ 2025-02-07

386 downloads per month

Apache-2.0 OR LGPL-2.1-or-later

19KB
64 lines

Buffered Mutexes

downloads dependents license Latest version Documentation

Sometimes, multiple threads need to update a shared value so frequently that the overhead of an atomic or a Mutex becomes a bottleneck. If, however, only the cumulative result of the update is important, and not any of the intermediate values, a BufMutex makes it possible to pass around multiple cloneable SharedBufMutexs containing a local value that can be updated without synchronization, and that will be combined into the global value when the SharedBufMutexs are dropped. This pattern works particular well with methods such as like rayon's for_each_with, map_with, and so on.

Acknowledgments

This software has been partially supported by project SERICS (PE00000014) under the NRRP MUR program funded by the EU - NGEU. Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union or the Italian MUR. Neither the European Union nor the Italian MUR can be held responsible for them.

No runtime deps