beetlebug▾
/

thread id

Gives the id of the calling thread.

thread::id

Description

The command thread::id gives the id of the thread that runs it. The main thread of a group is tid0x1.

Returns

A thread id.

Examples

% thread::id
tid0x1

% set t [thread::create]
> expr {[thread::send $t thread::id] eq $t}
1

Errors

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