[gdal-dev] How to correctly initialize GDAL library in a multithreaded environment?
kshpuryk
kostia.shpuryk at gmail.com
Mon Jan 14 03:02:40 PST 2019
Hi,
I have a multithreaded application that uses GDAL. Generally it works fine,
but sometimes I have a hang when trying to create transformations from
different threads.
Seems like race condition occures when initializing static CPLMutex
*hConfigMutex located in gdal\port\cpl_conv.cpp file;
I was able to fix the issue by calling a function that initializes the mutex
before calls from different threads(just calling the following code:
CPLGetConfigOption("GDAL_DATA", nullptr);) but it doesn't feel right.
So, my question is: What is the correct way to initialize GDAL library in
multithreaded environment?(if such exists). If there are no such
possibility, maybe some function INITGDAL() can be added that will do the
magic?
Best regards,
KS.
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list