[−][src]Module async_std::sync
Synchronization primitives.
This module is an async version of std::sync.
Examples
Spawn a task that updates an integer protected by a mutex:
use std::sync::Arc; use async_std::sync::Mutex; use async_std::task; let m1 = Arc::new(Mutex::new(0)); let m2 = m1.clone(); task::spawn(async move { *m2.lock().await = 1; }) .await; assert_eq!(*m1.lock().await, 1);
Structs
| Arc | A thread-safe reference-counting pointer. 'Arc' stands for 'Atomically Reference Counted'. |
| Barrier | unstableA barrier enables multiple tasks to synchronize the beginning of some computation. |
| BarrierWaitResult | unstableA |
| Mutex | A mutual exclusion primitive for protecting shared data. |
| MutexGuard | A guard that releases the lock when dropped. |
| RwLock | A reader-writer lock for protecting shared data. |
| RwLockReadGuard | A guard that releases the read lock when dropped. |
| RwLockWriteGuard | A guard that releases the write lock when dropped. |
| Weak |
|