26 #define _CRT_NONSTDC_NO_DEPRECATE 1
27 #define _CRT_SECURE_NO_DEPRECATE 1
31 #define WIN32_LEAN_AND_MEAN
37 __int64 Timer::time() {
38 LARGE_INTEGER perfCounter;
39 QueryPerformanceCounter(&perfCounter);
40 return perfCounter.QuadPart;
45 LARGE_INTEGER frequency;
46 QueryPerformanceFrequency(&frequency);
47 ticksPerSeconds = frequency.QuadPart;
52 startTime = this->time();
55 long Timer::elapsedTime() {
56 stopTime = this->time();
57 return static_cast<long>(((stopTime - startTime) * 1000000) / ticksPerSeconds);
69 _mutex = CreateMutex(NULL, FALSE, NULL);
77 WaitForSingleObject(
_mutex, INFINITE);
86 InitializeCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(
_spinlock));
90 DeleteCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(
_spinlock));
96 EnterCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(
_spinlock));
100 LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(
_spinlock));
105 #endif // defined(WINDOWS)