Using Message Passing to Transfer Data Between Threads - The Rust Programming Language
One increasingly popular approach to ensuring safe concurrency is message passing, where threads or actors communicate by sending each other messages containing data. Here’s the idea in a slogan from the Go language documentation: “Do not communicate by sharing memory; instead, share memory by communicating.” To accomplish message-sending concurrency, Rust’s standard library provides an implementation of channels. A channel is a general programming concept by which data is sent from one thread to another. You can imagine a channel in programming as being like a directional channel of water, such as a stream or a river. If you put something like a rubber duck into a river, it will travel downstream to the end of the waterway. A channel has two halves: a transmitter and a receiver. The transmitter half is the upstream location where you put the rubber duck into the river, and the receiver half is where the rubber duck ends up downstream. One part of your code calls methods on the transmi
Transfer Data Between Threads with Message Passing - The Rust Programming Language Keyboard shortcuts Press ← or → to navigate between chapters Press S or / to search in the book Press ? to show this help Press Esc to hide this help Auto Light Rust Coal Navy Ayu The Rust Programming Language Transfer Data Between Threads with Message Passing One increasingly popular approach to ensuring safe concurrency is message passing, where threads or actors communicate by sending each other messages containing data. Here’s the idea in a slogan from the Go language documentation : “Do not communicate by s
Explore this link on the map →saved by
related reading
- Shared-State Concurrency - The Rust Programming Languagedoc.rust-lang.org
- Fearless Concurrency - The Rust Programming Languagedoc.rust-lang.org
- Rust Language Cheat Sheetcheats.rs
- Using Threads to Run Code Simultaneously - The Rust Programming Languagedoc.rust-lang.org
- std::sync::mpsc - Rustdoc.rust-lang.org
- Channels | Tokio - An asynchronous Rust runtimetokio.rs
- References and Borrowing - The Rust Programming Languagedoc.rust-lang.org
- Reading 14: Concurrencyweb.mit.edu
- What is Ownership? - The Rust Programming Languagedoc.rust-lang.org
- Async Rust Is A Bad Languagebitbashing.io
- A half-hour to learn Rustfasterthanli.me
- Reading 18: Message-Passing and Networkingweb.mit.edu