Re: [Libjpeg-turbo-users] Is the TurboJPEG API thread-safe?
SIMD-accelerated libjpeg-compatible JPEG codec library
Brought to you by:
dcommander
|
From: Cosmin A. <cos...@gm...> - 2013-01-11 03:59:06
|
> Everything should be thread-safe, as long as you use a different tjhandle in every thread. I would not expect it to be necessarily reentrant. Or, at least, I have never designed for or tested for that, so if it is reentrant, it's purely a lucky accident. TurboVNC and VirtualGL use the TurboJPEG API with multiple threads (as do other apps), and there are no known issues. You are correct that tjGetErrorStr() is not technically thread-safe, but since the error handler always writes to the same static buffer, and the pointer to that buffer is always returned by tjGetErrorStr(), the worst case if two threads have an error simultaneously is that one may get a garbled or incorrect error message. But I guess it might be a good idea to add a tjGetErrorStr2() function that accepts a tjhandle. Hi DRC, this cleared it up for me, thanks for the explanation. |