From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpeV9-000801-LV for qemu-devel@nongnu.org; Thu, 20 Jun 2013 09:02:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpeOA-0002vB-Df for qemu-devel@nongnu.org; Thu, 20 Jun 2013 08:55:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpeOA-0002v7-5F for qemu-devel@nongnu.org; Thu, 20 Jun 2013 08:54:58 -0400 Date: Thu, 20 Jun 2013 14:54:54 +0200 From: Stefan Hajnoczi Message-ID: <20130620125454.GF16926@stefanha-thinkpad.redhat.com> References: <1371203313-26490-1-git-send-email-stefanha@redhat.com> <1371203313-26490-7-git-send-email-stefanha@redhat.com> <20130620072633.GA24927@localhost.nay.redhat.com> <51C2C258.1050003@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51C2C258.1050003@redhat.com> Subject: Re: [Qemu-devel] [RFC 06/13] qemu-thread: add TLS wrappers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Anthony Liguori , Ping Fan Liu , qemu-devel@nongnu.org On Thu, Jun 20, 2013 at 10:50:32AM +0200, Paolo Bonzini wrote: > Il 20/06/2013 09:26, Fam Zheng ha scritto: > > On Fri, 06/14 11:48, Stefan Hajnoczi wrote: > >> From: Paolo Bonzini > >> > >> Fast TLS is not available on some platforms, but it is always nice to > >> use it. This wrapper implementation falls back to pthread_get/setspecific > >> on POSIX systems that lack __thread, but uses the dynamic linker's TLS > >> support on Linux and Windows. > >> > >> The user shall call alloc_foo() in every thread that needs to access the > >> variable---exactly once and before any access. foo is the name of the > >> variable as passed to DECLARE_TLS and DEFINE_TLS. Then, get_foo() will > >> return the address of the variable. It is guaranteed to remain the same > >> across the lifetime of a thread, so you can cache it. > > > > Would tls_alloc_foo() and tls_get_foo() be easier to read and less > > possible for name conflict? > > Fine by me. Nice, idea. Will fix in the next version. Stefan