Andrej van der Zee wrote:
Hi,

Thanks, that helps!

Since I am developing my modules in C++, I think I should be using this one:

apr_status_t apr_thread_data_set        (       void *           data,
                const char *    key,
                apr_status_t(*)(void *)         cleanup,
                apr_thread_t *          thread  
        )


Note that there is a difference between the apr_thread_data_*() methods and the apr_threadkey_private_*() methods. The apr_thread_data_*() methods actually associate your data with the thread->pool. Since each new apr thread has it's own private thread->pool everything should work fine.

The apr_threadkey_private_*() methods use the underlying thread libraries TLS routines.

While apr_thread_data_* may work for you, true TLS is only supplied by apr_threadkey_private_* routines.
        

If I understand correctly, I can pass my own cleanup function (calling
"delete" to free memory) which is called automatically when the thread
is destroyed by the APR framework. Would that be the way, or am I
still misunderstanding something?

This is correct. cleanup is a ptr to a function that gets passed a pointer to your data. You can choose to dealloc your data within this function.


srp
--
http://saju.net.in

Reply via email to