[−][src]Module swc_common::sync
This module defines types which are thread safe if cfg!(parallel_queries) is true.
Lrc
is an alias of either Rc or Arc.
Lock
is a mutex.
It internally uses parking_lot::Mutex
if cfg!(parallel_queries) is true,
RefCell
otherwise.
RwLock
is a read-write lock.
It internally uses parking_lot::RwLock
if cfg!(parallel_queries) is true,
RefCell
otherwise.
MTLock
is a mutex which disappears if cfg!(parallel_queries) is false.
MTRef
is a immutable reference if cfg!(parallel_queries), and an mutable
reference otherwise.
rustc_erase_owner!
erases a OwningRef owner into Erased or Erased + Send +
Sync depending on the value of cfg!(parallel_queries).
Re-exports
pub use std::sync::atomic::Ordering::SeqCst; |
Structs
AtomicBool | A boolean type which can be safely shared between threads. |
AtomicUsize | An integer type which can be safely shared between threads. |
Lock | |
Lrc | A thread-safe reference-counting pointer. 'Arc' stands for 'Atomically Reference Counted'. |
MTLock | |
Once | A type whose inner value can be written once and then will stay read-only |
OneThread | A type which only allows its inner value to be used in one thread. It will panic if it is used on multiple threads. |
RwLock | |
SerialScope | |
Weak |
|
Enums
Ordering | Atomic memory orderings |
Traits
HashMapExt | |
ParallelIterator | Parallel version of the standard iterator trait. |
Send | Types that can be transferred across thread boundaries. |
Sync | Types for which it is safe to share references between threads. |
Functions
assert_send | |
assert_send_sync_val | |
assert_send_val | |
assert_sync | |
join | Takes two closures and potentially runs them in parallel. It returns a pair of the results from those closures. |
par_iter | |
scope | Create a "fork-join" scope |
serial_join | |
serial_scope |
Type Definitions
LockGuard | An RAII implementation of a "scoped lock" of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked. |
MTRef | |
MappedLockGuard | An RAII mutex guard returned by |
MappedReadGuard | An RAII read lock guard returned by |
MappedWriteGuard | An RAII write lock guard returned by |
MetadataRef | |
ReadGuard | RAII structure used to release the shared read access of a lock when dropped. |
WriteGuard | RAII structure used to release the exclusive write access of a lock when dropped. |