Module rustc_data_structures::sync [] [src]

This mdoule 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.

LockCell is a thread safe version of Cell, with set and get operations. It can never deadlock. It uses Cell when cfg!(parallel_queries) is false, otherwise it is a Lock.

MTLock is a mutex which disappears if cfg!(parallel_queries) is false.

rustc_global! gives us a way to declare variables which are intended to be global for the current rustc session. This currently maps to thread-locals, since rustdoc uses the rustc libraries in multiple threads. These globals should eventually be moved into the Session structure.

rustc_erase_owner! erases a OwningRef owner into Erased or Erased + Send + Sync depending on the value of cfg!(parallel_queries).

Structs

Lock
LockCell
LockGuard

A wrapper type for a mutably borrowed value from a RefCell<T>.

Lrc

A single-threaded reference-counting pointer. 'Rc' stands for 'Reference Counted'.

MTLock
ReadGuard

Wraps a borrowed reference to a value in a RefCell box. A wrapper type for an immutably borrowed value from a RefCell<T>.

RwLock

A mutable memory location with dynamically checked borrow rules

WriteGuard

A wrapper type for a mutably borrowed value from a RefCell<T>.

Traits

Send
Sync

Functions

assert_send_sync_val
assert_sync

Type Definitions

MetadataRef