Project

General

Profile

Thread-safe

Added by Adrian F about 12 years ago

XmpProperties has been implemented as a static class. If I have two files which use the 'album' namespace in their xmp and both are parsed in seperate threads, then potentially both threads could recognise the 'album' namespace as new and try to register it at the same time. The result is memory leaks when the map XmpProperties::nsRegistry_ is freed, memory leaks are not that much of a problem but if this aspect of xmp parsing is not thread-safe are there any more that are also not thread-safe? If exiv2 was never designed to be thread-safe then thats fine and I will serialise my access to it, if though it is supposed to be thread-safe then the usage of static classes should be reviewed. Regards.


Replies (2)

RE: Thread-safe - Added by Andreas Huggel about 12 years ago

The situation is described to the best of my understanding here: http://dev.exiv2.org/wiki/exiv2/Thread_safety
The use-case you mention is interesting. It looks like a good reason to serialize access to XmpProperties::nsRegistry_.
Other static classes are fine, they only have read-only data.

Andreas

RE: Thread-safe - Added by Adrian F about 12 years ago

Thanks for the prompt reply, the wiki article is interesting and I shall serialize access to the areas of xmp parsing it suggests. Regards.

    (1-2/2)