Ryan Tandy wrote:
On Wed, Aug 28, 2019 at 01:34:31PM +0100, Howard Chu wrote:
This is not a safe assumption on Windows, unfortunately. While libldap uses native Windows mutexes on Windows, a lot of code built using gcc/g++ uses a posixthreads emulation library for thread and mutex support, and the user-visible structures are not compatible with native mutexes. (I've found this to be a significant problem for g++ std::mutex, std::thread, etc.)
Thanks for mentioning that. GnuTLS also uses native Windows threads when building for Windows (including mingw-ish environments), so it should still be OK; but I'd better go and figure out a smoke test on Windows too.
How does this work on the OpenSSL side? For 1.1.0+ it sounds like the same situation, with OpenSSL using the Windows native API as well.
Does "incompatible" just mean that a single mutex object can't be shared between the two APIs? (I don't think that would be an issue for our case.) Or is it something stronger like a pthreads mutex not being able to synchronize native threads, or outright not being able to use both interfaces in a single process?
Passing a native structure to the posixthreads interface (and vice versa) will crash the program (or worse - silently corrupt memory without crashing the program....)