qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 06/13] qemu-thread: add TLS wrappers


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC 06/13] qemu-thread: add TLS wrappers
Date: Thu, 20 Jun 2013 14:54:54 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> >>
> >> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]