In a typical CC++ threaded application, a thread is implimented within
a "Run" method, and hence, it's "this" is essentially a pointer to the
current thread. The use of thread object pointers is both more generic (portable) and more useful in CC++ than the system thread
Id.
For objects that are not themselves a subclass of Thread, the getThread() function can be used to return the Thread object which
represents the currently executing thread context. This allows classes that can have methods invoked from multiple threads to identify who is executing. However, as a practical consideration, I have not found direct need for it in the applications and classes I currently have written.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm curious why there is no getThreadID() method?
And, how can I manage threads without this?
Seems there is a getThread method but it was left undocumented.
In a typical CC++ threaded application, a thread is implimented within
a "Run" method, and hence, it's "this" is essentially a pointer to the
current thread. The use of thread object pointers is both more generic (portable) and more useful in CC++ than the system thread
Id.
For objects that are not themselves a subclass of Thread, the getThread() function can be used to return the Thread object which
represents the currently executing thread context. This allows classes that can have methods invoked from multiple threads to identify who is executing. However, as a practical consideration, I have not found direct need for it in the applications and classes I currently have written.