If your threads are not starting, your main browser thread code is synchronously depending on them after their creation. Refactor the code to not assume that the threads would be synchronously available after creation, but periodically yield back to the main thread browser event loop after the thread creation.
With such structure, you can set -s PTHREAD_POOL_SIZE=0. There is no possibility to have an infinite/unbounded number of synchronously available threads on the web. Although by using asyncify emulation, that might be possible, but not sure if asyncify handles this atm? la 9. toukok. 2020 klo 12.42 Talha Enes Ayrancı ([email protected]) kirjoitti: > > Probably this is the case. New threads don't start. So I need give higher > values to PTHREAD_POOL_SIZE. > > But I think this is not a healty solution. Because as the number of threads > increases, RAM usage increases. What is your advices? > > 9 Mayıs 2020 Cumartesi 07:57:05 UTC+3 tarihinde Sam Clegg yazdı: >> >> But doesn't the PTHREAD_POOL_SIZE just determine how many initial threads to >> create? >> >> IIRC you can still create more threads than that at runtime.. up until you >> run out of machine resources. i.e. PTHREAD_POOL_SIZE is not an upper >> limit on the total number of threads. >> >> The only caveat is that new threads don't actually start until you return to >> the event loop (at least when they are started from the main thread). >> >> On Fri, May 8, 2020 at 1:42 PM Alon Zakai <[email protected]> wrote: >>> >>> If you want the ability to pick PTHREAD_POOL_SIZE at runtime, you can do >>> that by setting PTHREAD_POOL_SIZE to something like >>> "Module.pthreadPoolSize", and build with MODULARIZE. Then you can pass in { >>> pthreadPoolSize: .. } when you create an instance, and give it the pool >>> size at runtime there. >>> >>> (Maybe I didn't understand the description, but if your program itself uses >>> more threads depending on the size of the file, you may need to make the >>> program use up to a fixed number of threads.) >>> >>> >>> On Fri, May 8, 2020 at 8:31 AM Talha Enes Ayrancı <[email protected]> >>> wrote: >>>> >>>> Hi. I have a image processing app with coding C++. When I compile my codes >>>> with USE_PTHREAD=1 flag, compiled code is not working. Nothing happening >>>> on Chrome. And when I add PTHREAD_POOL_SIZE flag, it's working. But my >>>> thread size is different for every file. Big files are using more threads >>>> than small sized files. Thread count is increasing to 40-50 and more and >>>> more.. >>>> 50 POOL_SIZE is so big value. What can I do? >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "emscripten-discuss" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/emscripten-discuss/e9909928-b9ad-43e3-bb6e-c83935305ee7%40googlegroups.com. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpTjA6Bu3BjUB8b_bHtUemniO0XXafOf4K8Kh4urMXom5w%40mail.gmail.com. > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/6c1f75cf-3598-40f6-a534-323737342653%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CA%2B6sJ-2htO6s-PpZk1AS6TeP9d2_iegzceWEnsryj%3DBDodjZWQ%40mail.gmail.com.
