X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=thread_win.c;h=a882f80d00f14d1f7df1deec61a4a82ed08863c3;hb=276e463972834a60d2c8cc23de2a65af8589a8c6;hp=a55e6b4cdac01e7acba1ec29933e971f842b5add;hpb=6c0d08022b81a1f9792c07861e50a2351d383f19;p=xonotic%2Fdarkplaces.git diff --git a/thread_win.c b/thread_win.c index a55e6b4c..a882f80d 100644 --- a/thread_win.c +++ b/thread_win.c @@ -16,23 +16,36 @@ qboolean Thread_HasThreads(void) return true; } -void *Thread_CreateMutex(void) +void *_Thread_CreateMutex(const char *filename, int fileline) { - return (void *)CreateMutex(NULL, FALSE, NULL); + void *mutex = (void *)CreateMutex(NULL, FALSE, NULL); +#ifdef THREADDEBUG + printf("%p create %s:%i\n" , mutex, filename, fileline); +#endif + return mutex; } -void Thread_DestroyMutex(void *mutex) +void _Thread_DestroyMutex(void *mutex, const char *filename, int fileline) { +#ifdef THREADDEBUG + printf("%p destroy %s:%i\n", mutex, filename, fileline); +#endif CloseHandle(mutex); } -int Thread_LockMutex(void *mutex) +int _Thread_LockMutex(void *mutex, const char *filename, int fileline) { +#ifdef THREADDEBUG + printf("%p lock %s:%i\n" , mutex, filename, fileline); +#endif return (WaitForSingleObject(mutex, INFINITE) == WAIT_FAILED) ? -1 : 0; } -int Thread_UnlockMutex(void *mutex) +int _Thread_UnlockMutex(void *mutex, const char *filename, int fileline) { +#ifdef THREADDEBUG + printf("%p unlock %s:%i\n" , mutex, filename, fileline); +#endif return (ReleaseMutex(mutex) == FALSE) ? -1 : 0; }