ThreadCancellation.currentThreadId

ulong currentThreadId() @property @safe @nogc nothrow

Returns the current thread's ID for use with cancellation functions.