Skip to content

Commit 5e514f0

Browse files
committed
Add non-parallel execution for WASM builds in parallel.hpp
NP-1172
1 parent 336723f commit 5e514f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/libnest2d/parallel.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#endif
1515

1616
namespace libnest2d { namespace __parallel {
17-
17+
1818
template<class It>
1919
using TIteratorValue = typename std::iterator_traits<It>::value_type;
2020

@@ -56,8 +56,14 @@ inline void enumerate(
5656

5757
for(TN fi = 0; fi < N; ++fi) rets[fi].wait();
5858
#endif
59+
60+
#ifdef __EMSCRIPTEN__
61+
// For WASM/Emscripten builds, always use non-parallel execution
62+
// due to limited threading support in WebAssembly
63+
for(TN n = 0; n < N; n++) fn(*(from + n), n);
64+
#endif
5965
}
6066

6167
}}
6268

63-
#endif //LIBNEST2D_PARALLEL_HPP
69+
#endif //LIBNEST2D_PARALLEL_HPP

0 commit comments

Comments
 (0)