I try to write a thread pool implementation on top of Apache APR,
I meet some problems:

1. apr_thread_create (apr_thread_t **new_thread, ....., apr_pool_t *cont)

I've trace the source code about this function,
internally, it uses "count" to allocate the memory for  apr_thread_t, & pthread_t
like :

(*new) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t));
(*new)->td = (pthread_t *)apr_pcalloc(pool, sizeof(pthread_t));

and it uses "count" as parent pool to create a new pool for this thread,

when "child threads" exit, they will automatically destroy their own pool,
but the questions is this will still leave the apr_thread_t, & pthread_t
memory allocated in the parent pool "dangling".

can I solve the "dangling" memory problem when creating Thread Pool on top of APR?
because threads are created & exit (if nessary) all the time in my implementatin.

Sting, Cheng Po-wen(Gդ)
Phone :  886-3-5914545  Fax : 886-3-5820085
E-Mail : sting@itri.org.tw

Internet Software Technology Division(W100)
Computer & Communication Research Lab. / ITRI