<div>Hello,</div>
<div>&nbsp;</div>
<div>I have run into some threading issues accessing a .tab file from multiple threads. Each thread has it&#39;s own OGRDataSource so the OGRDataSource objects won&#39;t get accessed from more than one thread at a time. The GDAL faq says:
</div>
<div>&nbsp;</div>
<div>&quot;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&quot;</div>
<div>&nbsp;</div>
<div>Is the same thing true for OGR? (&nbsp;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>&nbsp;</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&#39;t used thread local storage much myself so i don&#39;t know how good it works or if it differs alot between different compilers. I havn&#39;t tried to define CPL_THREADLOCAL myself yet to see if it works but i&#39;ll hope i&#39;ll get time to do that.
</font></p>
<p>My problems occur while i&#39;m trying to extract the styling info and i end up with an empty style string when running multiple threads.</p>
<p>&nbsp;</p>
<p>Regards,</p>
<p>Daniel Bäck</p></div>
<div>&nbsp;</div>