Intermediate Rust
Q44 / 100

What is the Mutex<T> in Rust?

Correct! Well done.

Incorrect.

The correct answer is B) A mutual exclusion primitive that provides safe mutable access to T across threads, returning a MutexGuard when locked

B

Correct Answer

A mutual exclusion primitive that provides safe mutable access to T across threads, returning a MutexGuard when locked

Explanation

let data = Arc::new(Mutex::new(5)); let guard = data.lock().unwrap(); *guard += 1; — the guard releases the lock when dropped.

Progress
44/100