mm2 / Little-CMS

A free, open source, CMM engine. It provides fast transforms between ICC profiles.
https://www.littlecms.com
MIT License
572 stars 177 forks source link

Ensure threadsafe alternative of gmtime is used #263

Closed kleisauke closed 3 years ago

kleisauke commented 3 years ago

Hello, thanks for maintaining LCMS.

As discussed in https://github.com/mm2/Little-CMS/issues/170, gmtime uses internal storage that is static, which means that it's not threadsafe. This PR ensures that threadsafe alternatives of this function are used (if available).

This has been successfully tested on the JPEG XL test suite under ThreadSanitizer without requiring a mutex in the top-level APIs (see https://github.com/libjxl/libjxl/issues/53).

Cheers, Kleis

mm2 commented 3 years ago

Looks great, thank you!