beetlebug▾
/

tsv pop

Gives the value of an element of a shared array and removes the element.

tsv::pop ARRAY ELEMENT

Description

The command tsv::pop gives the value of the element and removes the element, in one step under the lock of the array.

Arguments

ArgumentTypeDefaultDescription
ARRAYarray namerequiredThe name of the shared array.
ELEMENTstringrequiredThe name of the element.

Returns

The value of the element.

Examples

% tsv::set q job 42
> list [tsv::pop q job] [tsv::exists q job]
42 0

Errors

% tsv::pop
wrong # args: should be "tsv::pop array key ?args?"
-errorcode TCL WRONGARGS

% tsv::set q job 42
> tsv::pop q nope
no key q(nope)
-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

See also