I'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't shared across threads then STL thread safety wouldn't be an issue. I'm not sure which statics could affect this, as I haven'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"><<a href="mailto:lalinsky@gmail.com">lalinsky@gmail.com</a>></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, Николай Шафоростов <<a href="mailto:shafff@ukr.net">shafff@ukr.net</a>> wrote:<br>
> Hi. We're getting crashes when using taglib from different threads (different files) on windows<br>
> all of them are in the crt functions called from std iterators (e.g. String's basic_string<ushort> iterator used in isLatin() methid, and also ByteVector's iterators).<br>
><br>
> The hypothesis is that std iterators are not thread-safe on win32.<br>
><br>
> 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'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't believe that'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>