Identifying Threads
Recursive locks must acquire a value that uniquely identifies a thread of execution. This value helps determine whether the recursive lock blocks or simply increments its count.
A thread “id” might also be required:
*When you need to directly call the underlying API.
*When doing your own thread identification within both your program logic and any debug or status output that you produce.
Thread identification is implemented by the following functions:
*RWThreadId rwThreadId()
*RWThreadId RWRunnableHandle::threadId() (in the Threading package)
The Synchronization package encapsulates the underlying thread id using the RWThreadId class. Instances of this class can be used just as if they are instances of the underlying thread id type. That’s because the RWThreadId class defines constructors and conversion operators that allow it to be used in this manner.
You can use the rwThreadId() function to retrieve the id of the current or calling thread. Any thread can call this function, not just threads created by the library.