wiki:rfc16_ogr_reentrancy

Version 3 (modified by warmerdam, 17 years ago) ( diff )

--

RFC 16: OGR Thread Safety

Author: Frank Warmerdam
Contact: warmerdam@…
Status: Development

Summary

In an effort to better support thread safety in OGR some methods are added as internal infrastructure is updated.

Definitions

Reentrant: A reentrant function can be called simultaneously by multiple threads provided that each invocation of the function references unique data.

Thread-safe: A thread-safe function can be called simultaneously by multiple threads when each invocation references shared data. All access to the shared data is serialized.

Objective

To make all of the OGR core and selected drivers reentrant, and to make the driver registrar, drivers and datasources at least potentially thread-safe.

TestCapability()

The TestCapability() method on the driver, and datasource will be extended to include ways of testing for reentrancy and thread safety on particular instances. The following macros will be added:

#define OLCReentrant "Reentrant"
#define ODsReentrant "Reentrant"
#define ODsThreadSafe "Threadsafe"

Note that layers cannot be threadsafe as long as layer feature reading status is implicit in the layer object. The default return value for all test values is FALSE, as is normal for the TestCapability() method, but specific drivers can return TRUE after determining that the driver datasources or layers are in fact reentrant and/or threadsafe.

Note: See TracWiki for help on using the wiki.