<div dir="ltr"><div>Thank you for the quick answer!</div><div><br></div>The version of GDAL is 2.2.3 and OS is Windows.<div><br></div><div>I'm using not the latest version, but I've checked the latest code and it seems like it will still reproduce for Windows for 2.5.0.</div><div><br></div><div>Yeah, I've found the ticket, so I'll wait until fixed and will try to update to latest version.</div><div><br></div><div>Thanks,</div><div>KS.</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 14, 2019 at 1:16 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
> <br>
> I have a multithreaded application that uses GDAL. Generally it works fine,<br>
> but sometimes I have a hang when trying to create transformations from<br>
> different threads.<br>
> <br>
> Seems like race condition occures when initializing static CPLMutex<br>
> *hConfigMutex located in gdal\port\cpl_conv.cpp file;<br>
<br>
On which operating system and with which GDAL version ?<br>
With recent enough GDAL versions, and on Linux/Unix, I believe that mutex <br>
creation should now be thread-safe. But there might still be issues on <br>
Windows. We should be able to fix that more easily with C++11 mutex now.<br>
<br>
Please file a ticket about that on<br>
<a href="https://github.com/OSGeo/gdal/issues" rel="noreferrer" target="_blank">https://github.com/OSGeo/gdal/issues</a> with the above requested details.<br>
<br>
> <br>
> I was able to fix the issue by calling a function that initializes the mutex<br>
> before calls from different threads(just calling the following code:<br>
> CPLGetConfigOption("GDAL_DATA", nullptr);) but it doesn't feel right.<br>
<br>
Calling a function like GDALRegisterAll() that involves mutex creation before <br>
creating any thread has been the historical recommandation<br>
<br>
Even<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</blockquote></div>