On Fri, Nov 24, 2017, at 21:33, Dave Cheney wrote:
> > In Rust a thread has its own memory space and hence a thread cannot 
> > reference data by reference of some other thread.
> 
> How is this accomplished? Is there a prohibition against passing a
> borrowed reference between threads?

In general, yes. Data types in Rust can allow themselves to be accessed
by multiple threads and define the semantics of how that happens. There
are several ways in which data can be shared between threads, and all of
them are safe. These include sending a value on a channel or accessing
it via a mutex (mutex's in rust take ownership of the value, so you send
the mutex and can only access the value through that so you can't forget
to lock/unlock it), implementing Copy semantics, etc.

This is an old, but still valid, blog post on the topic of concurrency
in Rust: https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html

—Sam

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to