[Gdal-dev] Is OGR reentrant?

Mateusz Loskot mateusz at loskot.net
Fri Sep 22 11:26:19 EDT 2006


ugeni79 at gmail.com wrote:
> Hi, I am using gdal 1.3.1 on windows and when I try to read from two 
> different shapefiles at the same time from two different threads my 
> application crashes.  Is OGR (or maybe in this case shapelib)
> supposed to be reentrant?  If not, has anyone looked at what it would
> take to make it reentrant? Any help would be greatly appreciated!

Are you talking about reentrance or thread-safety?
According to my understanding, both are different concepts.
Generally, reentrance provides calls across processes, but thread-safety
works across threads in frames of single process.

Certainly, it's possible function is reentrant and thread-safe at the
same time, but also function can be thread-safe but not reentrant, etc.

For GDAL thread-safety, please refer to FAQ 10.
http://www.gdal.org/faq.html
Note, I'm not sure how up to date is this FAQ.

For OGR thread-safety, I'm inclined to say that non-mutual access is
thread-safe in OGR. I also believe that more strict thread-safety can be
achived on the client side using threading capabilities provided by CPL.
Unfortunately, it doesn't apply to reentrance, because reentrance
requires much deeper changes and policies on (low) level of single
function call.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list