You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should use pthread for posix systems, windows threads for windows systems. We should get rid of the dependency on pthread-win32 and instead provide small wrappers around OS-specific code ourselves. This makes compiling with msvc easier.
The text was updated successfully, but these errors were encountered:
Having to #include <pthread.h> means all the "portable" C code is now tainted with OS-specific includes, making static analysis a lot harder.
We don't actually need most of pthreads-win32, we only need mutexes, so making a small wrapper that exposes exactly what we need allows us to strictly limit the amount of system-dependent APIs we use. So no, this is not "implement pthreads-win32".
If all you want is not to bring OS-specific includes in the scope, then just hide them, make a tox_pthread.h and tox_pthread.c wrapper around pthread.h that will hide them inside tox_pthread.c.
Making such wrapper is easy and will also allow us to use all of the other features of pthreads-win32 besides mutexes if a need arises, because otherwise, if we would need more stuff than mutexes, we'd need to either implement the missing OS abstraction ourselves or scrap all the mutex code you are proposing to write and implement this pthread.h wrapper I'm suggesting.
pthread.h wrapper hiding the OS-specific includes is easy to make, requires no maintenance, pthreads-win32 on Windows is already implemented and battle-tested so there are unlikely to be bugs, and it's easily extendable.
It should use pthread for posix systems, windows threads for windows systems. We should get rid of the dependency on pthread-win32 and instead provide small wrappers around OS-specific code ourselves. This makes compiling with msvc easier.
The text was updated successfully, but these errors were encountered: