develooper Front page | perl.perl5.porters | Postings from January 2011

Re: Turn $$ into a magical readonly variable that always fetches getpid()

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
January 2, 2011 14:56
Subject:
Re: Turn $$ into a magical readonly variable that always fetches getpid()
Message ID:
AANLkTikxd6nAZq1pntqMpYE1r7vr7bjVFB8Kgq5Qti40@mail.gmail.com
On Sun, Jan 2, 2011 at 7:46 PM, Nicholas Clark <nick@ccl4.org> wrote:
> I had wondered if this was something to do with "THREADS_HAVE_PIDS"
> (IIRC something to do with fun Linux threading models) but git blame seems
> to suggest that this caching dates back to 5.000

I think you're refering to "LinuxThreads", the threading
implementation that preceded NTPL. It violated POSIX in various ways
and I don't think anyone still uses it on modern systems (NTPL has
been out since 2003), but there are probably still older systems
(pre-2.6) out there that use it.

> But I'm not sure whether taking it out would affect things under the "fun"
> threading models. Given that "THREADS_HAVE_PIDS" works to ensure that the
> parent process ID doesn't change unexpectedly, does this mean that getpid()
> on those threading models gives a different answer in different threads?

Yeah, LinuxThreads did exactly that. Consult your pthreads(7) man page
if you happen to be running Linux.

Leon

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About