lodepng icon indicating copy to clipboard operation
lodepng copied to clipboard

please add information about thread-safety

Open sena73 opened this issue 4 years ago • 2 comments

Please extend "readme" or add somewhere else information on thread-safety. Which limitations exist?

sena73 avatar Sep 17 '20 15:09 sena73

It should be thread safe to encode/decode a different image on each thread. Each must have their own state objects, their own memory buffers, and so on. You cannot use a single LodePNGState in mutliple threads at once, but you can use a different LodePNGState (or function that creates one internally like all the convenience encode/decode functions) in each thread.

It doesn't use any global variables in a thread unsafe manner internally.

Does that answer your question?

I should double check and verify before adding this officially to the readme.

lvandeve avatar Sep 18 '20 16:09 lvandeve

Does that answer your question?

Yes, this answers my question. Thank you.

sena73 avatar Feb 03 '21 09:02 sena73