From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpaZr-0004hV-UL for qemu-devel@nongnu.org; Thu, 20 Jun 2013 04:50:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpaZo-000700-W2 for qemu-devel@nongnu.org; Thu, 20 Jun 2013 04:50:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpaZo-0006zr-Ax for qemu-devel@nongnu.org; Thu, 20 Jun 2013 04:50:44 -0400 Message-ID: <51C2C258.1050003@redhat.com> Date: Thu, 20 Jun 2013 10:50:32 +0200 From: Paolo Bonzini MIME-Version: 1.0 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> In-Reply-To: <20130620072633.GA24927@localhost.nay.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Stefan Hajnoczi , qemu-devel@nongnu.org, Kevin Wolf , Anthony Liguori , Ping Fan Liu 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. Paolo