Changes between Version 2 and Version 3 of RFC3
- Timestamp:
- Oct 17, 2008, 11:48:53 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RFC3
v2 v3 17 17 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. In order to prevent maintenance issues the OLD API will be changed to call the NEW API with a global handle. The handle (GEOSContextHandle_t) will be an opaque type to allow exentensions without recompilation being required. Function names in the new API will be updated with an _r, as is the familiar C standard for reentrant/thread safe versions. Current GEOS functions that do not make reference to the context handle will not be changed. 18 18 19 The intent will be to altogether replace the existing functions with the _r functions in a future release, making the thread safe versions the only supported functions. 20 21 === Example Prototypes === 22 Here are examples of what some of the new function prototypes would be. 23 24 {{{ 25 extern void GEOS_DLL initGEOS_r(GEOSConextHandle_t *handle, 26 GEOSMessageHandler notice_function, 27 GEOSMessageHandler error_function); 28 extern void GEOS_DLL finishGEOS_r(GEOSContextHandle_t *handle); 29 30 31 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPoint_r(GEOSContextHandle_t *handle, 32 GEOSCoordSequence* s); 33 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing_r(GEOSContextHandle_t *handle, 34 GEOSCoordSequence* s); 35 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLineString_r(GEOSContextHandle_t *handle, 36 GEOSCoordSequence* s); 37 }}} 38 39 For comparison, here are the same functions as they exist now. 40 41 {{{ 42 extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function, 43 GEOSMessageHandler error_function); 44 extern void GEOS_DLL finishGEOS(void); 45 46 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPoint(GEOSCoordSequence* s); 47 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing(GEOSCoordSequence* s); 48 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLineString(GEOSCoordSequence* s); 49 }}} 50 19 51 == Limitations == 20 52 This change will focus on making a thread safe version of the API. Other extensions to the context handle have been suggested, e.g. Access to other geometry factories, overriding memory allocators. These extensions are beyond the current scope of this design, but this design will be implemented to allow such extensions in the future.