Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
ConditionVariable.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Core module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_CONDITIONVARIABLE_HPP
8 #define NAZARA_CONDITIONVARIABLE_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/MovablePtr.hpp>
12 
13 namespace Nz
14 {
15  class ConditionVariableImpl;
16  class Mutex;
17 
18  class NAZARA_CORE_API ConditionVariable
19  {
20  public:
22  ConditionVariable(const ConditionVariable&) = delete;
23  ConditionVariable(ConditionVariable&& condition) noexcept = default;
25 
26  void Signal();
27  void SignalAll();
28 
29  void Wait(Mutex* mutex);
30  bool Wait(Mutex* mutex, UInt32 timeout);
31 
32  ConditionVariable& operator=(const ConditionVariable&) = delete;
33  ConditionVariable& operator=(ConditionVariable&& condition) noexcept = default;
34 
35  private:
37  };
38 }
39 
40 #include <Nazara/Core/ConditionVariable.inl>
41 
42 #endif // NAZARA_CONDITIONVARIABLE_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Core class that represents a signal, a list of objects waiting for its message.
Definition: Signal.hpp:27
Core class that represents a condition variable.
Definition: ConditionVariable.hpp:18
Core class that represents a binary semaphore, a mutex.
Definition: Mutex.hpp:17