Customize the stack size of the threads used by pupnp through the new THREAD_STACK_SIZE variable

This patch allows a user to customize the stack size of the threads used by
pupnp through the new THREAD_STACK_SIZE variable. This is especially useful
on embedded systems with limited memory where the user can set THREAD_STACK_SIZE
to ITHREAD_STACK_MIN.

However, as this modification can have side effects, I set 0 as the default
value, so threads will continue to use the default stack size of the system
(which varies greatly as stated in
https://computing.llnl.gov/tutorials/pthreads/).
This commit is contained in:
Fabrice Fontaine
2010-09-18 05:56:29 -03:00
committed by Marcelo Roberto Jimenez
parent 8fbecaee5e
commit 467f9987a1
7 changed files with 149 additions and 3 deletions

View File

@@ -282,6 +282,7 @@ static int UpnpInitThreadPools(void)
TPAttrInit(&attr);
TPAttrSetMaxThreads(&attr, MAX_THREADS);
TPAttrSetMinThreads(&attr, MIN_THREADS);
TPAttrSetStackSize(&attr, THREAD_STACK_SIZE);
TPAttrSetJobsPerThread(&attr, JOBS_PER_THREAD);
TPAttrSetIdleTime(&attr, THREAD_IDLE_TIME);
TPAttrSetMaxJobsTotal(&attr, MAX_JOBS_TOTAL);