Hi, I have been prototyping a thread safe CAPI. I have attached a simple proposal/design intent. I have sample executables and test data that will illustrate the thread issues but I don't want to flood the mailing list with them. If the proposal attached looks decent to you all I'll create a new ticket and attach the code I have to that.
Thanks, Chuck
Summary: The current CAPI in GEOS is not thread safe. The error handling and initialization/finalization process specifically can cause problems. Definitions: (As defined by Frank Warmerdam in http://trac.osgeo.org/gdal/wiki/rfc16_ogr_reentrancy) 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: Allow the GEOS CAPI to be thread safe. Testing: An example test executable will be provided that shows the current problem. It is copied from the existing CAPI test tool. Once the thread safe API is created the test tool will be updated to the new interface. Which should address the former problems. Implementation: In order to implement the thread safe API, the current API will be copied and all static variables will be placed into a 'handle.' This handle will be initialized on the initGeos call. Once initialized it will be passed to all subsequent GEOS functions, allowing each thread to have it's own copy of the data. This will not affect the current API as it will be provided in addition to the old API. Though it will result in a maintenance issue, with two sets of similar code.
_______________________________________________ geos-devel mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/geos-devel
