Implemented thread handling for WaitForMultipleObjects.

Implemented thread specific functions:
* Thread debugging (open handles, ...) now available via CMake flag
** Add DumpThreadHandles wherever you want to know the state of thread handles
* CloseHandle now properly supports threads via registered close function
* WaitForSingleObject and WaitForMultipleObjects now support threads in INFINITE and timed wait.
* WaitForMultipleObjects bWaitAll now supported
* _GetCurrentThread now actually returns a valid handle.

* Thread pool cleanup fixed, now properly cleaning up resources in ArrayList free function and exiting thread.
* pthread_mutex_timedlock now using actual timeout instead of 10ms polling.
I've read the article and I really don't know who would want a pthread_suspend() function. When a thread gets suspended it should always be a volontary action (from the thread). Otherwise you can get suspended with some mutex hold and lead to a deadlock.