Uno/Spec/Thread Affinity Bridge

From Apache OpenOffice Wiki
< Uno‎ | Spec
Jump to: navigation, search

Type: specification State: stable

A purpose bridge protecting thread-affine objects.


The thread-affinity bridge ensures that encapsulated objects are always called by the same thread, thus compensating any thread-affinity. The affinity bridge also ensures, that calls into or through it do not show any thread awareness.

Only one thread at a time can enter an affinity environment, an affinity environment is entered, if any thread has one of the methods provided by the Enterable API on the stack.


Some APIs have thread-affinities in respect to particular handles they return. For example, on Win32 the window-destroy and -message functions require to be called by the same thread which actually created the window. This thread-affinity is inherited when developing APIs on top of these thread-affine APIs.

In general, thread-affine APIs are hard to program, especially in generic frameworks where it is not knowable before hand how long a thread lives and on whichs objects it calls.


A purpose bridge named ":affine".


Personal tools