thread preserve
Adds one to the reference count of a thread.
thread::preserve ?ID?
Description
The command thread::preserve adds one to the reference count of the thread ID, or of the calling thread, and gives the new count. A new thread has the count 0, or 1 with -preserved. Each thread::release subtracts one, and at 0 the thread::wait of the thread returns.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| ID | thread id | none | The thread, by default the calling thread. |
Returns
The new reference count.
Examples
% set t [thread::create]
> thread::preserve $t
> thread::preserve $t
2
Errors
% thread::preserve tid0x99
thread "tid0x99" does not exist
-errorcode NONE
% thread::preserve nothread
invalid thread handle "nothread"
-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