beetlebug▾
/

thread broadcast

Sends a script to each other thread of the group.

thread::broadcast SCRIPT

Description

The command thread::broadcast sends SCRIPT with -async to each thread of the group except the calling thread, and gives an empty string at once. An error of the script in a thread goes to the proc of thread::errorproc or to the output.

Arguments

ArgumentTypeDefaultDescription
SCRIPTscriptrequiredThe script for each other thread.

Returns

An empty string.

Examples

% set t [thread::create]
> thread::broadcast {set ::b 1}
> thread::send $t {set ::b}
1

# With no other thread, the script goes nowhere.
% thread::broadcast {set ::b 1}

Errors

% thread::broadcast
wrong # args: should be "thread::broadcast script"
-errorcode TCL WRONGARGS

Facts

Capability
thread. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also