From 66ad415ce5b59b7ca62d1b330322d133b6afc963 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 1 Apr 2018 19:15:46 +0200 Subject: [PATCH] Remove windows.h dependency from tracy_sema.h. --- common/tracy_sema.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/common/tracy_sema.h b/common/tracy_sema.h index da3f088a..0b76e10c 100644 --- a/common/tracy_sema.h +++ b/common/tracy_sema.h @@ -30,9 +30,16 @@ namespace tracy // Semaphore (Windows) //--------------------------------------------------------- -#include -#undef min -#undef max +#ifndef MAXLONG +enum { MAXLONG = 0x7fffffff }; +enum { INFINITE = 0xFFFFFFFF }; +typedef void* HANDLE; + +extern "C" __declspec(dllimport) HANDLE __stdcall CreateSemaphoreA( void*, long, long, const char* ); +extern "C" __declspec(dllimport) int __stdcall CloseHandle( HANDLE ); +extern "C" __declspec(dllimport) unsigned long __stdcall WaitForSingleObject( HANDLE, unsigned long ); +extern "C" __declspec(dllimport) int __stdcall ReleaseSemaphore( HANDLE, long, long* ); +#endif class Semaphore { @@ -46,7 +53,7 @@ public: Semaphore(int initialCount = 0) { assert(initialCount >= 0); - m_hSema = CreateSemaphore(NULL, initialCount, MAXLONG, NULL); + m_hSema = CreateSemaphoreA(NULL, initialCount, MAXLONG, NULL); } ~Semaphore()