Ocular Engine
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
ThreadManager.hpp
1
#pragma once
2
#ifndef __H__OCULAR_CORE_THREAD_MANAGER__H__
3
#define __H__OCULAR_CORE_THREAD_MANAGER__H__
4
5
#include <future>
6
#include <thread>
7
#include <utility>
8
#include <vector>
9
10
//------------------------------------------------------------------------------------------
11
12
namespace
Ocular
13
{
14
namespace
Core
15
{
50
class
ThreadManager
51
{
52
public
:
53
54
ThreadManager
();
55
~
ThreadManager
();
56
69
/*template<typename F, typename ... Args>
70
inline auto spawnAsync(F&& function, Args&& ... args) -> std::async<F, Args>
71
{
72
auto result = std::async(std::forward<F>(function), std::forward<Args>(args) ...);
73
74
if (result.wait_for(0) == std::future_status::deferred)
75
{
76
// Async task was created as deferred.
77
// Call wait on the future to force it's execution to begin.
78
result.wait();
79
}
80
81
return result;
82
}*/
83
93
/*template<typename F, typename ... Args>
94
inline auto spawnAsyncNow(F&& function, Args&& ... args) -> std::async<F, Args>
95
{
96
return std::async(std::launch::async, std::forward<F>(function), std::forward<Args>(args) ...);
97
}*/
98
106
/*template<typename T, typename ... F>
107
inline void waitForAsyncs(F&& ... futures)
108
{
109
std::vector<std::future<T>*> futuresContainer = { futures ... };
110
111
for (auto iter = futuresContainer.begin(); iter != futuresContainer.end(); ++iter)
112
{
113
(*iter)->wait();
114
}
115
}*/
116
117
protected
:
118
119
private
:
120
};
121
}
122
}
123
124
//------------------------------------------------------------------------------------------
125
126
#endif
Ocular::Core::ThreadManager
Definition:
ThreadManager.hpp:50
Ocular
Note: Once this library is made dynamic, this will no longer be needed.
Definition:
Common.hpp:70
OcularCore
include
Threads
ThreadManager.hpp
Generated on Tue Oct 18 2016 01:28:56 for Ocular Engine by
1.8.10