Supplying RWThreadAttribute Instances To Threaded Runnables
RWThreadAttribute instances can be supplied to threaded runnable objects at one of two times:
*When the runnable objects are constructed (see Supplying RWThreadAttribute Instances At Construction).
*After construction, using accessor functions (see Supplying RWThreadAttribute Instances After Construction).
RWThreadAttribute objects can be supplied to and shared between any number of threaded runnable objects. Changes made to the values of a shared thread attribute instance can be seen by all runnables that have been given a handle to that attribute instance.
The thread attribute instance referenced by each threaded runnable is only used or evaluated at the time the thread is created. A threaded runnable makes a local copy of its current thread attribute instance each time start() is called. This prevents the attribute values that were present when a thread was created from being lost as a result of future changes in a runnable’s thread attribute instance or the attribute’s values.
Changing a runnable’s thread attribute instance or values of that attribute instance does not affect the active thread, if any, possessed by the runnable object. Attribute changes can only affect the next thread created as result of a call to start().