iterators+multithreading on win32

Stephen F. Booth me at sbooth.org
Sat Mar 5 18:00:07 CET 2011


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?

Stephen

2011/3/5 Lukáš Lalinský <lalinsky at gmail.com>

> On Sat, Mar 5, 2011 at 10:59 AM, Николай Шафоростов <shafff at ukr.net>
> wrote:
> > Hi. We're getting crashes when using taglib from different threads
> (different files) on windows
> > 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).
> >
> > The hypothesis is that std iterators are not thread-safe on win32.
> >
> > What do you think if i convert the code to not use iterators (e.g.
> ifdefing the code)?
>
> The main problem is that TagLib uses non-thread-safe reference
> counting on shared objects. Until this is fixed, you should not use
> TagLib from multiple threads (yes, even on different files).
>
> I'm not aware of any code in TagLib that would use STL iterators
> across functions that could potentially get called from different
> threads, so I don't believe that's the problem.
>
> Lukas
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110305/a885d2e9/attachment.htm 


More information about the taglib-devel mailing list