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

Reply via email to