lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.08k stars 425 forks source link

please add information about thread-safety #138

Open sena73 opened 4 years ago

sena73 commented 4 years ago

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

lvandeve commented 4 years ago

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.

sena73 commented 3 years ago

Does that answer your question?

Yes, this answers my question. Thank you.