Uno/Binary/Impl/Thread Affinity Bridge
From Apache OpenOffice Wiki
Type: Implementation State: Finished Availability: URE 1.3 (SRC680_m212)
Implementation of Uno/Binary/Spec/Thread Affinity Bridge.
The Thread Affinity Bridge ensures that thread affine objects are always called by the same thread.
It does this by using a private thread, to which it switches prior actually invoking a particular object. This private thread is therefore the thread objects may create an affinity to. The affinity also switches back to the originator thread, in case an object tries to call out, this ensures thread transparency.
The Affinity Bridge behaves as follows,
- entering a Thread Affine environment associates the current thread with it, in case the environment already has a thread associated, the enter blocks until no object is registered any more,
- leaving a Thread Affine environment disassociates the current thread from the Environment, in case objects are still mapped, the leave blocks until no object is registered any more,
- calling into the Thread Affinity environment, leads to the invocation of the passed function by the associated thread,
- calling out of the Thread Affinity environment, leads to the invocation of the passed function by the in-calling thread, in case of no in-calling thread, the associated thread calls out directly.