[gdal-dev] GDAL thread safety

Leith Bade leith at leithalweapon.geek.nz
Tue Oct 2 17:39:55 PDT 2012


Hi,

I am working on a Java tiling program that uses GDAL to read the source
files. (Writing is done via Java ImageIO)

Currently I am trying to implement multithreaded processing to speed the
program up.

I note on the FAQ that it says that GDAL is thread safe if you open a new
dataset for each thread.

I have done that in my program so each thread has it's own dataset pointing
to the same file.

However I am having a problem with ReadRaster(). When I call this function
in parallel on each thread some of the image data returned is corrupted.

I note the FAQ says some drivers might not be thread safe, but more
recently on this mailing list it was said that most GDAL tree code only
drivers should be thread safe.

The file I am having problems with is a VRT file that references a raw file
using VRTRawRasterBand.

I have used gdal_translate to convert it to a TIFF and that does not have
problems.

Is it possible the VRT driver is not thread safe?

Also, is there an official list of thread safe drivers? If not could
someone with the knowledge perhaps update the FAQ to list the 'vetted'
drivers?

I would use the list to build a white list into my program that controls
whether is runs the single or multi threaded version.

Thanks,
Leith Bade
leith at leithalweapon.geek.nz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121003/74f61e48/attachment.html>


More information about the gdal-dev mailing list