Uno/Spec/Threading-Model
From Apache OpenOffice Wiki
author: Kr
version: 8163
state: draft
created: 12/12/2005
type: specification
UNO Threading Model
- Feature
- The UNO Runtime provides support for implementing
- Thread Safe, or
- Thread Unsafe, or
- Thread Affine
- Code.
- The threading type of any code can be specified appropriately. The Thread Unsafe type is the default type for any implementation.
- Rationale
- API
- Purpose UNO Environments: The different threading models are accessible as standard UNO environments (CPP: uno/environment.h). Environment specifications (e.g.
"gcc3"
,"java"
) are extended by "purpose" specifiers (e.g.":mutex"
,":thread"
), purpose specifiers may be chained (e.g.":mutex:debug:test"
).
- The predefined purposes to objects according to their threading type are
-
":mutex"
- for thread unsafe code, -
":thread"
- for thread affine code, and -
""
- for thread safe code, to ensure compatibility with previous UNO versions.
-
- Stacked Environments: The current (purpose) environment does not only vary with the implementation language (e.g. Java or C++), but also with the executed codes declared threading type. Therefor an API for accessing the current environment is provided.
- Cascaded Mappings: Purpose environments may be passed to the Runtime for getting cascaded mappings (
"gcc3"
=>"java:mutex:debug"
).
- Implementation Environments: Client code as well as service code may be declared once, to either be thread safe, thread affine or thread unsafe.
- Dependencies
- Thread Environment
- Mutex Environment
- Cascaded Mapping
- Compatibility Issues
- None.