[geos-devel] CAPI Thread Safety

Mateusz Loskot mateusz at loskot.net
Fri Aug 22 14:36:08 EDT 2008


Charles Thibert wrote:
> Hello,
> 
> Little introduction first.  I'm working for Ingres with Andrew Ross
> on the new Ingres geospatial extensions.

Charles,

Welcome!

> Ingres is planning to re-use the GEOS library through the CAPI.

Great to hear.

> I've been looking over it to 1) familiarize myself with the code and
> 2) to identify possible thread safety issues.

That's quite a challenge, indeed.
I've not analysed thread-safety of GEOS myself (yet).

> There are two things that jump out at me.  1) The error/notification 
> handlers are definitely not thread safe unless each thread can use
> the same handlers.

Yes, your assumption is probably correct.

> 2) The geometryFactory worries me.  It seems like
> it may be thread safe, such that it creates new objects only.  I'm
> looking for some expert opinions on that.

Yes, the main responsibility of the factory is to create new geometry 
objects by number of named constructors provided.
Second, user can query factory object for details of precision model 
associated with it.
Third, GeometryFactory::destroyGeometry() helps to deallocate geometry 
object where it was constructed, it is important on Windows. See last 
Q&A here http://trac.osgeo.org/gdal/wiki/FAQMiscellaneous

> I've tried to search the archives of the mailing list but the .gz
> files don't seem to work for me and the online browsing isn't
> search-able, so forgive me if this questions been asked before...


You can input this line below to the Google box to get some discussions:

+thread +safety site:http://lists.osgeo.org/pipermail/geos-devel/

> Are there any current plans/work being done to make the CAPI more thread
> safe?

I am not aware of any plans. However, if there are some plans I'd expect 
them covered in appropriate RFC document (example [1]) proposing 
necessary chanages.

[1] http://trac.osgeo.org/gdal/wiki/rfc16_ogr_reentrancy

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the geos-devel mailing list