From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 15 22:33:56 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 70C2ECFA for ; Tue, 15 Jan 2013 22:33:56 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 88ABADCA for ; Tue, 15 Jan 2013 22:33:52 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id r0FMXjsj059904 for ; Tue, 15 Jan 2013 15:33:45 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r0FMXfAM003901; Tue, 15 Jan 2013 15:33:41 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: Getting the current thread ID without a syscall? From: Ian Lepore To: Alfred Perlstein In-Reply-To: <50F5D82C.7070400@mu.org> References: <20130115205403.GA52904@snakebite.org> <20130115211641.GC2522@kib.kiev.ua> <20130115213513.GA53047@snakebite.org> <20130115214332.GE2522@kib.kiev.ua> <50F5D82C.7070400@mu.org> Content-Type: text/plain; charset="us-ascii" Date: Tue, 15 Jan 2013 15:33:41 -0700 Message-ID: <1358289221.32417.129.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , Trent Nelson , "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2013 22:33:56 -0000 On Tue, 2013-01-15 at 14:29 -0800, Alfred Perlstein wrote: > On 1/15/13 1:43 PM, Konstantin Belousov wrote: > > On Tue, Jan 15, 2013 at 04:35:14PM -0500, Trent Nelson wrote: > >> > >> Luckily it's for an open source project (Python), so recompilation > >> isn't a big deal. (I also check the intrinsic result versus the > >> syscall result during startup to verify the same ID is returned, > >> falling back to the syscall by default.) > > For you, may be. For your users, it definitely will be a problem. > > And worse, the problem will be blamed on the operating system and not > > to the broken application. > > > Anything we can do to avoid this would be best. > > The reason is that we are still dealing with an "optimization" that perl > did, it reached inside of the opaque struct FILE to "do nasty things". > Now it is very difficult for us to fix "struct FILE". > > We are still paying for this years later. > > Any way we can make this a supported interface? > > -Alfred Re-reading the original question, I've got to ask why pthread_self() isn't the right answer? The requirement wasn't "I need to know what the OS calls me" it was "I need a unique ID per thread within a process." -- Ian