Re: [gdal-dev] GDAL reference counting is thread unsafe

2008-11-02 Thread Tamas Szekeres
Martin, Seems reasonable, however I expect we could avoid using critical sections in the windows code in this particular case using the Interlocked function would be quite enough. I'm uncertain how the windows headers are included in your code, but it looks like simply including in some places ma

RE: [gdal-dev] GDAL reference counting is thread unsafe

2008-11-01 Thread Martin Chapman
If anyone is interested the following code has been used safely on Windows and Linux for thread safe reference counting. You can paste it into a header file if you want, or use it as a guide. It uses pthreads on Linux and the Win32 thread functions on Windows with InterlockedIncrement() and Inter