apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@xbc.nu>
Subject Re: [PATCH] WIN32 allow destructors for apr_threadkey_private
Date Mon, 21 Aug 2006 17:58:33 GMT
Mladen Turk wrote:
> Hi,
> pthreads have option to register destruct callback
> for private thread keys created.
> Here is the patch that allow that for WIN32 but
> only when compiled as dll.
> Any comments or objections?
> The consequence is that the DllMain is added, and
> I suppose its not possible to have that functionality
> with static apr lib.
> OTOH it allows to have the same behavior like with
> pthreads actually calling provided callback to
> the apr_threadkey_private_create instead just ignoring
> it.

I've recently learned of a trick that would make this work anywhere,
even in a static lib, and wouldn't need DllMain. You can actually insert
your own constructors and destructors into the CRT's tables.

-- Brane

View raw message