IMQLock.token() method

Returns the token identifying the current holder of a given key, or undefined when the key is not locked.

Signature:

static token(key: string): number | undefined;

Parameters

Parameter

Type

Description

key

string

key to read the current holder's token for

Returns:

number | undefined

Remarks

Read it immediately after IMQLock.acquire() resolves and IMQLock.locked() confirms you are the holder, then hand it back to IMQLock.release() — that is what proves the release is yours. There is no way to recover it later: once the deadlock timeout has freed the key, this returns the NEXT holder's token, which is exactly the confusion the token exists to prevent.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.