From f8b804fc9fd68e508cd06a583ae410322f5c8f87 Mon Sep 17 00:00:00 2001 From: yjhn <54238857+yjhn@users.noreply.github.com> Date: Sun, 4 Sep 2022 15:12:56 +0300 Subject: [PATCH] update feature advaantages over std --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 70fdca7c..fa3da434 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,14 @@ The primitives provided by this library have several advantages over those in the Rust standard library: 1. `Mutex` and `Once` only require 1 byte of storage space, while `Condvar` - and `RwLock` only require 1 word of storage space. On the other hand the - standard library primitives require a dynamically allocated `Box` to hold - OS-specific synchronization primitives. The small size of `Mutex` in - particular encourages the use of fine-grained locks to increase - parallelism. + and `RwLock` only require 1 word of storage space. On the other hand on + some platforms (macOS and a few others) the standard library primitives + require a dynamically allocated `Box` to hold OS-specific synchronization + primitives. The small size of `Mutex` in particular encourages the use + of fine-grained locks to increase parallelism. 2. Since they consist of just a single atomic variable, have constant initializers and don't need destructors, these primitives can be used as - `static` global variables. The standard library primitives require - dynamic initialization and thus need to be lazily initialized with - `lazy_static!`. + `static` global variables. 3. Uncontended lock acquisition and release is done through fast inline paths which only require a single atomic operation. 4. Microcontention (a contended lock with a short critical section) is