openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openexr-devel] OpenEXR thread safety


From: Aristarkh A Zagorodnikov
Subject: [Openexr-devel] OpenEXR thread safety
Date: Mon, 31 Jan 2005 16:20:11 +0300

                Hello!

        Recently, while using the OpenEXR-1.2.1 I stumbled upon static
initialization (staticInitialize() in IlmImf/ImfHeader.cpp). While the rest
of the library looks thread-safe, this particular place not only looks
suspicious, it leads to random crashes in attribute registrations for header
attributes. 

        For now, I "fixed" the problem by placing a "critical section"
around code which uses IlmImf, but would like to note that fixing this
problem will surely save users of library from some unexpected errors. Of
course, I see that adding dependencies on something very platform-dependent
like thread synchronization library (e.g. WinAPI, pthreads, etc.) is no
good, yet I believe that it's not the only possible solution. I propose
addition of some sort of _optional_ initialization function, which _must_ be
called in a synchronized way. If you do not call the function - you get the
old behavior with it's problems, but your code is not broken. On the other
hand if you do - you have all the benefits of thread-safe library without
any explicit locking.

Aristarkh A Zagorodnikov
X-Infinity Software





reply via email to

[Prev in Thread] Current Thread [Next in Thread]