Class in thread compiler

Sender

class Sender
Import
use thread::{Sender};
Source: compiler/src/builtin_docs/thread.hy

The sending half of a channel made by channel.

Sender handles can be passed to spawn (alone or inside tuples, arrays, records and class instances): every copy refers to the same channel. close on any copy closes the channel for everyone.

Examples#

use thread::{channel, send, recv, Sender, Receiver};
use tests::assert;
let (tx, rx) = match channel() {
    Result::Ok(pair) => pair,
    Result::Err(_) => panic "channel failed",
};
let s: Sender = tx;
let r: Receiver = rx;
let _ = send(s, "hi");
let got = match recv(r) {
    Result::Ok(v) => v,
    Result::Err(_) => "",
};
assert!(got == "hi");

See also#

↑ ↓ navigate ↵ open