Win32: Fix object::cache::threadmania test on x64

The `object::cache::threadmania` test consistently crashes on Win32 x64. This is because the pthread API against which the test is written specifies a thread's return value as being pointer-sized. On Win32, the return value of a thread is 32 bits on all platforms, and so a pointer doesn't fit platforms with larger pointer sizes. When the return value is sized-up back to a pointer and dereferenced, the test case crashes.

This change fixes the problem by turning `git_thread` into a structure on Win32 with room for the thread handle, entry procedure pointer, and a `void *` parameter / return value member. To accomodate the programming model, the `git_thread_join` macro has been modified to require the address of a `git_thread` instead of passing it by value. This avoids passing a structure by value. The other `git_thread` function macros in use already accepted a `git_thread *` and did not require modification.

A randomly generated magic number incorporated into `win32\pthread.c` is used to check for clean thread exit. In the case of unclean exit, the `value` member of the `git_win32_thread` structure still contains the opaque value passed into the thread entry procedure, and should not be returned to the caller of `git_thread_join` as a proper return value. Furthermore, we should ensure that all threads started by the library terminate gracefully, so the implementation also raises an assert in the case of unclean thread termination.

While here I also fixed up a couple of warnings in `global.c` that MinGW complains about, and simplified the initialization logic for the Vista+ reader-writer lock function pointers.
I think the clarity of having `void *input` and `void *result` in here outweights 8 extra bytes. Anybody?