Implement concurrency primitives using WinAPI
Don't include pthread.h on Windows to avoid using pthreads emulation
libraries (such as winpthreads) by mistake.
Functions from platform.c that used pthreads are moved to unix.c,
their Windows counterparts are implemented in win32.c. Introduce a new
sync_win32.h header, counterpart of sync_unix.h. Use the
caml_plat_thread and caml_plat_thread_attr to abstract over the
system's thread id/handle type and thread attributes.
Use pairs of SRWLOCK and CONDITION_VARIABLES to replace pthreads
mutexes and condition variables.
POSIX states:
> The pthread_mutex_lock() function shall fail if:
> [EDEADLK]
> The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread
> already owns the mutex.
The Windows documentation states:
> Exclusive mode SRW locks cannot be acquired recursively. If a thread
> tries to acquire a lock that it already holds, that attempt will
> [...] deadlock (for AcquireSRWLockExclusive).
Deadlocks caused by recursive attemps to lock cannot be detected on
Windows.