thread join
Waits for the end of a joinable thread and gives its exit status.
thread::join ID
Description
The command thread::join waits until the thread ID ends and gives its exit status: the status of thread::exit, 0 for the end of its script, or 1 for an error. The thread must come from thread::create -joinable. While it waits, the caller runs the scripts that other threads send to it.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| ID | thread id | required | A joinable thread. |
Returns
The exit status, an integer.
Examples
% set t [thread::create -joinable {expr 1}]
> thread::join $t
0
% set t [thread::create -joinable {thread::exit 3}]
> thread::join $t
3
% set t [thread::create -joinable]
> thread::release $t
> thread::join $t
0
Errors
% thread::join
wrong # args: should be "thread::join id"
-errorcode TCL WRONGARGS
% thread::join tid0x99
cannot join thread tid0x99
-errorcode NONE
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