iterators+multithreading on win32

Lukáš Lalinský lalinsky at gmail.com
Sat Mar 5 11:37:42 CET 2011


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


More information about the taglib-devel mailing list