Difference between revisions of "Uno/Spec/Thread Affinity Bridge"

From Apache OpenOffice Wiki
< Uno‎ | Spec
Jump to: navigation, search
m (Fixed links.)
m (Relativated links.)
Line 6: Line 6:
  
 
; Description
 
; Description
: The Thread Affine Bridge protects [[Uno/Spec/Thread Affine|Thread Affine]] objects from being called by wrong threads. It does this by providing a dedicated thread, into which it delegates the calls prior to invocation. This dedicated thread is therefor the thread objects create any affinity to.
+
: The Thread Affine Bridge protects [[../Thread Affine|Thread Affine]] objects from being called by wrong threads. It does this by providing a dedicated thread, into which it delegates the calls prior to invocation. This dedicated thread is therefor the thread objects create any affinity to.
  
 
; Feature:  
 
; Feature:  
: A [[Uno/Spec/Purpose Bridge|Purpose Bridge]] protecting [[Uno/Spec/Thread Affine|Thread Affine]] objects:
+
: A [[../Purpose Bridge|Purpose Bridge]] protecting [[../Thread Affine|Thread Affine]] objects:
 
: - <code>enter</code>: Associates the current thread with the [[Uno/Spec/Environment|Environment]]
 
: - <code>enter</code>: Associates the current thread with the [[Uno/Spec/Environment|Environment]]
 
: - <code>leave</code>: In case no objects are mapped it disassociates the current thread from the [[Uno/Spec/Environment|Environment]], in case objects are mapped and this is the last <code>leave</code>, it blocks until no object is mapped anymore.
 
: - <code>leave</code>: In case no objects are mapped it disassociates the current thread from the [[Uno/Spec/Environment|Environment]], in case objects are mapped and this is the last <code>leave</code>, it blocks until no object is mapped anymore.
Line 17: Line 17:
  
 
; Rationale
 
; Rationale
: Some APIs have [[Uno/Spec/Thread Affine|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.  
+
: Some APIs have [[../Thread Affine|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.
 
: 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.
  
Line 26: Line 26:
  
 
; Dependencies:
 
; Dependencies:
:* [[Uno/Spec/Environment Stack]]
+
:* [[../Environment Stack]]
  
 
[[Category:Uno:Spec]]
 
[[Category:Uno:Spec]]

Revision as of 11:30, 15 June 2006

version: 12513
state: draft
type: specification

Thread Affinity Bridge

Description
The Thread Affine Bridge protects Thread Affine objects from being called by wrong threads. It does this by providing a dedicated thread, into which it delegates the calls prior to invocation. This dedicated thread is therefor the thread objects create any affinity to.
Feature
A Purpose Bridge protecting Thread Affine objects:
- enter: Associates the current thread with the Environment
- leave: In case no objects are mapped it disassociates the current thread from the Environment, in case objects are mapped and this is the last leave, it blocks until no object is mapped anymore.
- callInto: Calls the desired method in the associated thread.
- callOut : Calls the desired method in the outer thread, if there is no outer thread yet, the associated thread is used.
Rationale
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.
API
Bridge named "affine".
Compatibility Issues
None.
Dependencies
Personal tools