Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
TaskScheduler.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_TASKSCHEDULER_HPP
8 #define NAZARA_TASKSCHEDULER_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/Functor.hpp>
12 
13 namespace Nz
14 {
15  class NAZARA_CORE_API TaskScheduler
16  {
17  public:
18  TaskScheduler() = delete;
19  ~TaskScheduler() = delete;
20 
21  template<typename F> static void AddTask(F function);
22  template<typename F, typename... Args> static void AddTask(F function, Args&&... args);
23  template<typename C> static void AddTask(void (C::*function)(), C* object);
24  static unsigned int GetWorkerCount();
25  static bool Initialize();
26  static void Run();
27  static void SetWorkerCount(unsigned int workerCount);
28  static void Uninitialize();
29  static void WaitForTasks();
30 
31  private:
32  static void AddTaskFunctor(Functor* taskFunctor);
33  };
34 }
35 
36 #include <Nazara/Core/TaskScheduler.inl>
37 
38 #endif // NAZARA_TASKSCHEDULER_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Core class that represents a thread pool.
Definition: TaskScheduler.hpp:15