From owner-freebsd-threads@FreeBSD.ORG Mon Jun 16 17:30:13 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CCFF137B401 for ; Mon, 16 Jun 2003 17:30:13 -0700 (PDT) Received: from sccrmhc13.attbi.com (sccrmhc13.comcast.net [204.127.202.64]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26BF843FA3 for ; Mon, 16 Jun 2003 17:30:11 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([12.233.125.100]) by attbi.com (sccrmhc13) with ESMTP id <20030616235353016001m3q2e>; Mon, 16 Jun 2003 23:53:53 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id QAA22610; Mon, 16 Jun 2003 16:53:52 -0700 (PDT) Date: Mon, 16 Jun 2003 16:53:51 -0700 (PDT) From: Julian Elischer To: Gareth Hughes In-Reply-To: <2D32959E172B8F4D9B02F68266BE421401A6D7E1@mail-sc-3.nvidia.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org cc: zander@mail.minion.de cc: 'Daniel Eischen' cc: Andy Ritger Subject: RE: NVIDIA and TLS X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2003 00:30:14 -0000 On Mon, 16 Jun 2003, Gareth Hughes wrote: > On Mon, 16 Jun 2003, Daniel Eischen wrote: > > > > Right. It just seems wrong to me to be able to insert __thread > > after every global variable in a library and instantly make > > it thread-safe. > > Why, exactly? Surely, from a programming point of view, this is > exactly what you want -- a transparent way to access your thread > local data. I think what Dan is saying is that there is a lot more to making a program thread-safe than just banging __thread before global variables. I think that it is sad that OpenGL has been implemented this way rather than passing an "our state" variable to each API call as is usually done. Because in the real world the market leader decides the rules and because Linux has decided to make the TLS hack standard, that means that many peolpe will use it. This means that the posix standard basically goes into the trash basket of history. If the lowest level calls took the 'current drawing context' (or whatever you call it) as an argument, then it wouldn't matter so much how it was originally derived. An occasional function call to derive it would be ok. it's the fact that you decide to derive it from first principles every time rather than caching it that is the problem. __thread can easily be derived in an efficient manner in a library independent manner using an entrypoint, but making it important to do it in 1 machine instruction is not possible in a library independent manner. I think that this is a BAD THING even if we end up having to do it somehow.. BTW in my previous comment re: wine and OpenGL does wine link with openGL? If not I'd just go for using %fs for now :-)