[gdal-dev] Locking of Open Shapefile

Frank Warmerdam warmerdam at pobox.com
Fri Jan 15 20:40:31 EST 2010


Joel Odom wrote:
> I've discovered that when I use OGRSFDriverRegistrar::Open to open a 
> Shapefile, the file remains locked so that another process can't open 
> the file until after I've called OGRDataSource::DestroyDataSource.  Is 
> there any way to prevent the file from being locked?  Thanks!

Joel,

Modern versions of GDAL/OGR route the open request for .shp and .dbf
files through VSIFOpenL().  The Win32 implmentation calls CreateFile()
with the sharing flags:

   FILE_SHARE_READ | FILE_SHARE_WRITE

As far as I know, this means that any other application which also tries
to open the files allowing shared access should be ok.  Is it possible
you are using quite an old version of GDAL/OGR?  Or that the other
application is requesting exclusive access?

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list