On Tue, Apr 5, 2011 at 4:53 PM, Arun Sharma <[email protected]> wrote:
> On Tue, Apr 5, 2011 at 4:32 PM, Paul Pluzhnikov <[email protected]>
> wrote:
>
>> Safer? I don't see how. You are still calling pthread_setspecific from a
>> potentially unsafe context.
>
> I meant: it gives us some freedom to move pthread_setspecific() call
> around. Like you observe, there is no safe place to call it from
> within libunwind.
Thanks for clarification.
> I lean towards #3:
>
> . Switch to using __thread, figure out some (likely extremely non-portable)
> way to perform cleanup on thread termination.
>
> This could be as simple as documenting a function that users are
> required to call on thread idle/exit to cleanup.
Right. It doesn't have to be idle/exit -- just calling
unwind_per_thread_once() from somewhere safe (so we can register the
specific with destructor) is enough.
If the user forgets, he gets a memory leak.
The Windows scheme of calling DllMain() with THREAD_{ATTACH,DETACH} sure
looks attractive right now.
--
Paul Pluzhnikov
_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel