Files
NazaraEngine/src/Nazara/Core/Win32/ConditionVariableImpl.hpp
Lynix ea8d683624 Updated copyright year
(532 files, wow)


Former-commit-id: cbb31f1124a86720bd3a54fe589a0f849a87b434
2015-01-21 20:53:01 +01:00

52 lines
985 B
C++

// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
#pragma once
#ifndef NAZARA_CONDITIONVARIABLEIMPL_HPP
#define NAZARA_CONDITIONVARIABLEIMPL_HPP
#include <Nazara/Prerequesites.hpp>
#include <atomic>
#include <windows.h>
class NzMutexImpl;
class NzConditionVariableImpl
{
public:
NzConditionVariableImpl();
#if NAZARA_CORE_WINDOWS_VISTA
~NzConditionVariableImpl() = default;
#else
~NzConditionVariableImpl();
#endif
void Signal();
void SignalAll();
void Wait(NzMutexImpl* mutex);
bool Wait(NzMutexImpl* mutex, nzUInt32 timeout);
private:
#if NAZARA_CORE_WINDOWS_VISTA
CONDITION_VARIABLE m_cv;
#else
enum
{
SIGNAL,
BROADCAST,
MAX_EVENTS
};
std::atomic_uint m_count;
HANDLE m_events[MAX_EVENTS];
#endif
};
#endif // NAZARA_CONDITIONVARIABLEIMPL_HPP