Back to course

Message Passing: Channels

Rust for Systems & Web3 Security

Communicating Between Threads

"Do not communicate by sharing memory; instead, share memory by communicating."

Rust uses channels for thread communication. A channel has a Transmitter (tx) and a Receiver (rx).

rust use std::sync::mpsc; let (tx, rx) = mpsc::channel();