beetlebug▾
/

thread exists

Tests if a thread runs.

thread::exists ID

Description

The command thread::exists gives 1 when the thread ID runs in the group, and 0 for a thread that ended or never existed.

Arguments

ArgumentTypeDefaultDescription
IDthread idrequiredThe thread to test.

Returns

1 or 0.

Examples

% thread::exists [thread::id]
1

% thread::exists tid0x99
0

% set t [thread::create]
> thread::release -wait $t
> thread::exists $t
0

Errors

% thread::exists
wrong # args: should be "thread::exists id"
-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