usync icon indicating copy to clipboard operation
usync copied to clipboard

Update advantages over types in std

Open yjhn opened this issue 1 year ago • 3 comments

Mutex, RwLock and CondVar are const-constructible in std since Rust 1.63. In most platforms pthread locks have been replaced with ones that do not allocate.

Maybe it should be noted that points 1-5 are implemented in std for most platforms?

yjhn avatar Sep 04 '22 12:09 yjhn

Yea, 1-5 can be simplified/updated to the following:

  1. All types require only 1 word of storage (unlike stdlib which stores more state for poison detection).
  2. Static initializers for all types (stdlib doesn't yet have this for Barrier).
  3. Inline uncontested paths and micro-contention handled with bounded, adaptive spinning.

kprotty avatar Sep 04 '22 13:09 kprotty

Yea, 1-5 can be simplified/updated to the following

Done.

yjhn avatar Sep 05 '22 12:09 yjhn

Sorry it's been a while.

6) looks like a duplicate of 5). Could it be removed?

kprotty avatar Sep 13 '22 22:09 kprotty

  1. looks like a duplicate of 5). Could it be removed?

Merged them. Not sure why 5 was about Mutex and RwLock and 6 was about Mutex<()> and RwLock<()>, since the docs for them don't mention that raw locking only works on ().

yjhn avatar Sep 14 '22 16:09 yjhn