Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Mutex.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_MUTEX_HPP
8 #define NAZARA_MUTEX_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/MovablePtr.hpp>
12 
13 namespace Nz
14 {
15  class MutexImpl;
16 
17  class NAZARA_CORE_API Mutex
18  {
19  friend class ConditionVariable;
20 
21  public:
22  Mutex();
23  Mutex(const Mutex&) = delete;
24  Mutex(Mutex&&) noexcept = default;
25  ~Mutex();
26 
27  void Lock();
28  bool TryLock();
29  void Unlock();
30 
31  Mutex& operator=(const Mutex&) = delete;
32  Mutex& operator=(Mutex&&) noexcept = default;
33 
34  private:
35  MovablePtr<MutexImpl> m_impl;
36  };
37 }
38 
39 #include <Nazara/Core/Mutex.inl>
40 
41 #endif // NAZARA_MUTEX_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Core class that represents a condition variable.
Definition: ConditionVariable.hpp:18
Core class that represents a binary semaphore, a mutex.
Definition: Mutex.hpp:17