From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtjhM-0000Gu-Lp for qemu-devel@nongnu.org; Wed, 17 Aug 2011 13:14:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtjhL-00062i-Fc for qemu-devel@nongnu.org; Wed, 17 Aug 2011 13:14:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtjhL-00061v-8S for qemu-devel@nongnu.org; Wed, 17 Aug 2011 13:14:35 -0400 Message-ID: <4E4BF6D6.5040801@redhat.com> Date: Wed, 17 Aug 2011 10:13:58 -0700 From: Paolo Bonzini MIME-Version: 1.0 References: <1313520667-26507-1-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org On 08/17/2011 09:51 AM, Stefan Hajnoczi wrote: > Hmm...this is pretty ugly low-level stuff. glib provides portable TLS > although I have found __thread significantly faster on Linux. > > I think our options are: > 1. Use __thread and require recent gcc versions on Windows. Not as > fast as native Windows TLS. > 2. Implement our own TLS abstraction to use native TLS on each platform. > 3. Use glib TLS (GStaticPrivate). It's slower than __thread on Linux > but seems portable. > > Options 1 and 3 seem better because they do not involve us > reimplementing yet more platform abstractions. True, but I'm afraid we'll need to reimplement more of them sooner or later, for example for PI locks. QEMU's needs in this area are just more low level than GLib's, though we could surely use glib's other threading primitives such as the thread pool. > Do you know which Windows gcc versions support __thread and if it > would be reasonable to require those versions? It's probably 4.3 and newer, or something like that. Paolo