Each thread and process is allocated an ID which is unique across all threads and processes.
The ID is allocated when the thread or process is created. The main motivation for the ID is to provide assistance for debuggers; it provides an easy way to identify threads and processes.
In general, applications and servers can use IDs for thread and process identification or, indeed, for whatever purpose that suits them.
While a thread ID is a property of the thread, it can be retrieved from
the thread by calling RThread::Id()
. The ID is encapsulated
by a TThreadId
object that is returned by the function.
The TThreadId
class provides ==
and !=
operators
for comparing two thread IDs.
The process ID is similar; it can be retrieved from the process by calling RProcess::Id()
,
and is encapsulated by a TProcessId
object returned by the
function.