<div>Hello,</div>
<div> </div>
<div>I have run into some threading issues accessing a .tab file from multiple threads. Each thread has it's own OGRDataSource so the OGRDataSource objects won't get accessed from more than one thread at a time. The GDAL faq says:
</div>
<div> </div>
<div>"In particular for the situation where many threads are reading from GDAL datasets at once should work as long as no two threads access the same <a class="el" href="http://www.gdal.org/classGDALDataset.html">GDALDataset
</a> object at the same time"</div>
<div> </div>
<div>Is the same thing true for OGR? ( or at least in the sense that it is supposed to be). I think i have tracked down the problem in this particular case to CPLSPrintf. The static buffers it is using is declared as:</div>
<div> </div>
<div><font color="#0000ff" size="2">
<p>static</p></font><font size="2"> CPL_THREADLOCAL </font><font color="#0000ff" size="2">char</font><font size="2"> gszCPLSPrintfBuffer[CPLSPrintf_BUF_Count][CPLSPrintf_BUF_SIZE];</font><font color="#0000ff" size="2">
<p>static</p></font><font size="2"> CPL_THREADLOCAL </font><font color="#0000ff" size="2">int</font><font size="2"> gnCPLSPrintfBuffer = 0;</font>
<p><font size="2">but CPL_THREADLOCAL is by default defined to nothing, a long time ago (23/5 2005) CPL_THREADLOCAL was defined to declspec(thread) in cpl_config.h.vc which should have made them thread local. But that was changed a month later or so. Was there a particular reason for that? I havn't used thread local storage much myself so i don't know how good it works or if it differs alot between different compilers. I havn't tried to define CPL_THREADLOCAL myself yet to see if it works but i'll hope i'll get time to do that.
</font></p>
<p>My problems occur while i'm trying to extract the styling info and i end up with an empty style string when running multiple threads.</p>
<p> </p>
<p>Regards,</p>
<p>Daniel Bäck</p></div>
<div> </div>