1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-30 15:39:54 +00:00

rogueviz:: added CAP_THREAD guard

This commit is contained in:
Zeno Rogue 2022-09-29 15:13:30 +02:00
parent ac088d1d41
commit 31318862cb

View File

@ -357,6 +357,7 @@ namespace objmodels {
/* parallelize a computation */ /* parallelize a computation */
inline int threads = 1; inline int threads = 1;
#if CAP_THREAD
template<class T> auto parallelize(long long N, T action) -> decltype(action(0,0)) { template<class T> auto parallelize(long long N, T action) -> decltype(action(0,0)) {
if(threads == 1) return action(0,N); if(threads == 1) return action(0,N);
std::vector<std::thread> v; std::vector<std::thread> v;
@ -371,6 +372,7 @@ namespace objmodels {
for(Res r: results) res += r; for(Res r: results) res += r;
return res; return res;
} }
#endif
} }