[geos-devel] Issues with smart pointers and threads?

David Blasby dblasby at refractions.net
Tue May 27 20:12:12 EDT 2003


I'm a bit concerned with using the reference counting since it could 
cause us some grief.  However, if this open source reference counter is 
good this might be easy.

Personally, I think wasting a wee bit of space for the precision model 
in a geometry isnt going to be that big a deal.

As for thread-safety, consider this:

Single threaded application makes a PrecisionModel.
This application forks 2 threads that both have access to this 
PrecisionModel.
Both threads create a bunch of geometries using the PrecisionModel.

If your reference counting is *not* thread-safe (ie. protected by a 
semephore), then there is a race condition if both threads try to 
increment the reference count at the same time.

dave




More information about the geos-devel mailing list