I&#39;ve also run into crashes like this in the past, when I tried to realize speed increases by parsing several files simultaneously in separate threads.  It seems that if atomic increment/decrement were added to RefCounter, as long as a single file wasn&#39;t shared across threads then STL thread safety wouldn&#39;t be an issue.  I&#39;m not sure which statics could affect this, as I haven&#39;t looked through the code in a while.  Is thread safety (or some level of it) something planned for a future release?<div>
<br></div><div>Stephen<br><br><div class="gmail_quote">2011/3/5 Lukáš Lalinský <span dir="ltr">&lt;<a href="mailto:lalinsky@gmail.com">lalinsky@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Sat, Mar 5, 2011 at 10:59 AM, Николай Шафоростов &lt;<a href="mailto:shafff@ukr.net">shafff@ukr.net</a>&gt; wrote:<br>
&gt; Hi. We&#39;re getting crashes when using taglib from different threads (different files) on windows<br>
&gt; all of them are in the crt functions called from std iterators (e.g. String&#39;s basic_string&lt;ushort&gt; iterator used in isLatin() methid, and also ByteVector&#39;s iterators).<br>
&gt;<br>
&gt; The hypothesis is that std iterators are not thread-safe on win32.<br>
&gt;<br>
&gt; What do you think if i convert the code to not use iterators (e.g. ifdefing the code)?<br>
<br>
</div>The main problem is that TagLib uses non-thread-safe reference<br>
counting on shared objects. Until this is fixed, you should not use<br>
TagLib from multiple threads (yes, even on different files).<br>
<br>
I&#39;m not aware of any code in TagLib that would use STL iterators<br>
across functions that could potentially get called from different<br>
threads, so I don&#39;t believe that&#39;s the problem.<br>
<br>
Lukas<br>
<div><div></div><div class="h5">_______________________________________________<br>
taglib-devel mailing list<br>
<a href="mailto:taglib-devel@kde.org">taglib-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/taglib-devel" target="_blank">https://mail.kde.org/mailman/listinfo/taglib-devel</a><br>
</div></div></blockquote></div><br></div>