We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 703ff00 commit 55c2062Copy full SHA for 55c2062
src/support/threads.cpp
@@ -139,15 +139,17 @@ void ThreadPool::initialize(size_t num) {
139
}
140
141
size_t ThreadPool::getNumCores() {
142
-#ifdef __EMSCRIPTEN__
+#if defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)
143
+ // In an Emscripten build without pthreads support, avoid the overhead of
144
+ // including support code for the below runtime checks.
145
return 1;
-#else
146
+#endif
147
+
148
size_t num = std::max(1U, std::thread::hardware_concurrency());
149
if (getenv("BINARYEN_CORES")) {
150
num = std::stoi(getenv("BINARYEN_CORES"));
151
152
return num;
-#endif
153
154
155
ThreadPool* ThreadPool::get() {
0 commit comments