Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Semaphore.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_SEMAPHORE_HPP
8 #define NAZARA_SEMAPHORE_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/MovablePtr.hpp>
12 
13 namespace Nz
14 {
15  class SemaphoreImpl;
16 
17  class NAZARA_CORE_API Semaphore
18  {
19  public:
20  Semaphore(unsigned int count);
21  Semaphore(const Semaphore&) = delete;
22  Semaphore(Semaphore&&) noexcept = default;
23  ~Semaphore();
24 
25  unsigned int GetCount() const;
26 
27  void Post();
28 
29  void Wait();
30  bool Wait(UInt32 timeout);
31 
32  Semaphore& operator=(const Semaphore&) = delete;
33  Semaphore& operator=(Semaphore&&) noexcept = default;
34 
35  private:
37  };
38 }
39 
40 #endif // NAZARA_SEMAPHORE_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Core class that represents a counting semaphore.
Definition: Semaphore.hpp:17