[gdal-dev] MUTEX_NONE question

Frank Warmerdam warmerdam at pobox.com
Tue Sep 11 21:40:28 PDT 2012


On Tue, Sep 11, 2012 at 1:08 PM, Martin Chapman <chapmanm at pixia.com> wrote:
> If I don’t want to use GDAL in thread safe mode on Windows can just define
> MUTEX_NONE in the nmake.opt file?  If not, is there a way I can do it.

Martin,

I believe so, yes.

> Also, I want to avoid caching.  Can I just define the env var
> GDAL_FORCE_CACHING and set it to NO?

No, I don't believe that will help much.  This configuration
options just exists (I think) to force use of caching for
drivers or situations where the native driver would normally
avoid it.

I am not aware of a build or configuration option you can
set to avoid caching.

If you really really want to avoid caching you can try
to directly call GDALRasterBand::ReadBlock() which
will completely avoid the block cache.  I haven't done
anything like that for a long time so it may cause
problems for some drivers.

>Will that also avoid any thread synchronization?

The MUTEX_NONE should stop essentially all thread
synchronization.  But if you are using multiple threads
you may encounter serious bugs with mutexes disabled.
Doing this makes the most case in single threaded apps
that want to avoid the operating system mutex overhead.

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 Software Developer


More information about the gdal-dev mailing list