On Thu, Nov 21, 2013 at 2:14 PM, Michael Spiegel <[email protected]> wrote: > Apologies ahead of time if this question has been discussed and/or resolved > elsewhere or previously. Looking at the rust manual in the chapter on the > memory and concurrency model (from git master) I think it states that > mutable portions of the heap cannot be shared. Aside: the wording is a > little confusing. Are there execution contexts in rust that are not tasks? > From the sentence that begins "When reading about the memory model, keep in > mind.." I couldn't determine if execution was comprised only of tasks or > whether there were things that are not tasks that share mutable state. > > Anyway assuming that there are not execution contexts that share mutable > state does this mean that the atomics library should be removed? > > Thanks, > --Michael
The safe subset of Rust can't make direct use of atomics, but it doesn't mean they aren't useful. They're a tool for `unsafe` code to use for building safe abstractions. Rust's standard library, including what you could call the runtime, is implemented in Rust. There is safe immutable shared memory implemented with atomic reference counting. Rust also has safe mutable shared memory via `MutexArc` and `RWArc`, which do locking in addition to atomic reference counting. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
