[threadpool] Saner default for max number of worker threads on android and ios
[mono.git] / mono / metadata / threadpool-ms.c
index 336f179a8502536e95db3263bb819fd68633c729..17936001106381195303b13ea8c3ed9b0dc88863 100644 (file)
@@ -304,7 +304,12 @@ initialize (void)
        threads_count = mono_cpu_count () * threads_per_cpu;
 
        threadpool->limit_worker_min = threadpool->limit_io_min = threads_count;
+
+#if defined (PLATFORM_ANDROID) || defined (HOST_IOS)
+       threadpool->limit_worker_max = threadpool->limit_io_max = CLAMP (threads_count * 100, MIN (threads_count, 200), MAX (threads_count, 200));
+#else
        threadpool->limit_worker_max = threadpool->limit_io_max = threads_count * 100;
+#endif
 
        threadpool->counters._.max_working = threadpool->limit_worker_min;