perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Dubois" <>
Subject RE: [PATCH] libperl leaks a THREAD_KEY each time it is reloaded
Date Tue, 11 Jan 2005 16:55:28 GMT
On Tue, 11 Jan 2005, Stas Bekman wrote:
> So each parent interpeter should be totally independent from other
> parent interpreters. I'm not sure if sharing the key is possible.
> Since you will end up with two threads from totally different pools
> using the same thread key. Or is it just fine?

This is not only fine, it is exactly as is should be: the thread key is
just a pointer to a thread local storage slot, which is an *index* into
the local stack.  So while the index is the same for each thread, the
actual memory location it points to in each thread is different.  This
means that Perl can find the current Perl interpreter by looking it
up at a fixed offset in the thread's stack.  This obviously only works
if the offset (thread key) is the same for each interpreter.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message