If i set the thread as detached, that I think is that I need (same that the old code that I sent)

//detaching the thread
apr_threadattr_detach_set(thd_attr,1);

What I have to do to reap and free all resources when this thread dies? 


2010/9/8 William A. Rowe Jr. <wrowe@rowe-clan.net>
On 9/8/2010 4:56 AM, Oscar Pernas wrote:
>
> Im using apr to throw new threads for making callbacks. My problem is that when I have
> made exactly 632 calls to the function throwOnMessage, the thread onMessage is not throwed
> by it anymore, the thread is not created (I've put traces into the first instruction and
> it is not executed). This code shuld work?

You are going to hit limits on any platform if you don't reap the threads you spawn.

apr_thread_join is going to block on the apr_thread_exit.  In APR, deleting (or
just clearing) the pool you used to create the thread (and thread attributes)
will then release all resources.



--
Óscar Pernas Plaza.