Inheritance diagram for MCThreadData:
Public Member Functions
|virtual void||attach ()|
|Called when attaching to a thread. |
|virtual void||detach ()|
|Called when detaching from a thread. |
|Construct a thread data. |
|Destruct a thread data - perform any required cleanup This is called when there are no more references to the MCThreadData. |
Only objects of classes derived from this class can be used as thread private data. Instances may be added to a thread by a call to MCThread::setData() or to the current thread and all future threads by a call to MCThread::setDataAll() Generally, a particular instance is set on only one thread so different threads have different instances. However, it is possible to call MCThread::setData() with the same ThreadData object for multiple threads.
Called when attaching to a thread.
If the thread data is registered for all threads then attach is called before the MCRunnable::run() method is called for a thread.
Called when detaching from a thread.
detach() is called when the thread exits or a new thread data is set for a particular index. In both cases it is called per thread on which the thread data is registered. Consequently, it may be called multiple times if the thread data has been set on more than one thread (or has been used in a MCThread::setDataAll() call).