<div>I have submitted a ticket #1979</div>
<div>&nbsp;</div>
<div>Best Regards,</div>
<div>&nbsp; Daniel Bäck<br><br></div>
<div class="gmail_quote">On Nov 8, 2007 5:19 PM, Tamas Szekeres &lt;<a href="mailto:szekerest@gmail.com">szekerest@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Daniel,<br><br>__declspec(thread) is a Microsoft VC specific so it cannot used as an<br>universal solution. Moreover it works in DLLs only when those DLLs are
<br>bound to the executable, and will not work for those loaded with<br>LoadLibrary().<br><br>In this particular case it would be reasonable to allocate the buffer<br>in the stack at the beginning of every function using these variables.
<br><br>Alternatively there&#39;s a fairly platform neutral TLS implementation in<br>gdal that can also be used.<br><br>You might want to submit a ticket with this issue.<br><br><br>Best regards,<br><br>Tamas<br><br><br><br>
2007/11/8, Daniel &lt;<a href="mailto:daniel112b@gmail.com">daniel112b@gmail.com</a>&gt;:<br>
<div>
<div></div>
<div class="Wj3C7c">&gt; Hello,<br>&gt;<br>&gt; I have run into some threading issues accessing a .tab file from multiple<br>&gt; threads. Each thread has it&#39;s own OGRDataSource so the OGRDataSource objects<br>&gt; won&#39;t get accessed from more than one thread at a time. The GDAL faq says:
<br>&gt;<br>&gt; &quot;In particular for the situation where many threads are reading from GDAL<br>&gt; datasets at once should work as long as no two threads access the same<br>&gt; GDALDataset object at the same time&quot;
<br>&gt;<br>&gt; Is the same thing true for OGR? ( or at least in the sense that it is<br>&gt; supposed to be). I think i have tracked down the problem in this particular<br>&gt; case to CPLSPrintf. The static buffers it is using is declared as:
<br>&gt;<br>&gt;<br>&gt;<br>&gt; static CPL_THREADLOCAL char<br>&gt; gszCPLSPrintfBuffer[CPLSPrintf_BUF_Count][CPLSPrintf_BUF_SIZE];<br>&gt;<br>&gt; static CPL_THREADLOCAL int gnCPLSPrintfBuffer = 0;<br>&gt;<br>&gt; but CPL_THREADLOCAL is by default defined to nothing, a long time ago (23/5
<br>&gt; 2005) CPL_THREADLOCAL was defined to declspec(thread) in cpl_config.h.vc<br>&gt; which should have made them thread local. But that was changed a month later<br>&gt; or so. Was there a particular reason for that? I havn&#39;t used thread local
<br>&gt; storage much myself so i don&#39;t know how good it works or if it differs alot<br>&gt; between different compilers. I havn&#39;t tried to define CPL_THREADLOCAL myself<br>&gt; yet to see if it works but i&#39;ll hope i&#39;ll get time to do that.
<br>&gt;<br>&gt; My problems occur while i&#39;m trying to extract the styling info and i end up<br>&gt; with an empty style string when running multiple threads.<br>&gt;<br>&gt;<br>&gt;<br>&gt; Regards,<br>&gt;<br>&gt; Daniel Bäck
<br>&gt;<br></div></div>&gt; _______________________________________________<br>&gt; Gdal-dev mailing list<br>&gt; <a href="mailto:Gdal-dev@lists.maptools.org">Gdal-dev@lists.maptools.org</a><br>&gt; <a href="http://lists.maptools.org/mailman/listinfo/gdal-dev" target="_blank">
http://lists.maptools.org/mailman/listinfo/gdal-dev</a><br>&gt;<br></blockquote></div><br>