qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Juan Pineda <juan@logician.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org,
	"Andreas Färber" <andreas.faerber@web.de>
Subject: Re: [Qemu-devel] Problem under OSX Lion: GThread-ERROR **: GThread system may only be initialized once
Date: Mon, 31 Oct 2011 16:36:04 +0000	[thread overview]
Message-ID: <20111031163604.GH27570@redhat.com> (raw)
In-Reply-To: <C86F4598-4BE3-444E-B29B-DA95CB46AB76@logician.com>

On Mon, Oct 31, 2011 at 09:25:26AM -0700, Juan Pineda wrote:
> The current Qemu master branch crashes under OSX with a GThread error.
> Commenting out vlc.c line 2188 (call to g_thread_init) allows it to run
> successfully.

As a general rule all calls to 'g_thread_init(NULL)' should be protected
by a conditional thus:

        if (!g_thread_supported())
            g_thread_init(NULL);

Even though QEMU calls g_thread_init() very early in main(), there is
always the possibility that some library QEMU links to, has got an ELF
initializer, triggering before main(), which calls g_thread_init().

NB on GLib versions >= 2.24, g_thread_init() is a no-op if called more
than once[1], but for sake of compatibility QEMU ought to use the conditonal
check.

Regards,
Daniel

[1] The reason for this change is that GObject itself actually calls
    g_thread_init() secretly too.
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2011-10-31 16:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18  1:22 [Qemu-devel] Patch for ui/cocoa.m Juan Pineda
2011-10-18  9:11 ` Andreas Färber
2011-10-18 14:35   ` Juan Pineda
2011-10-30 22:45     ` Andreas Färber
2011-10-31 15:32       ` Juan Pineda
2011-10-31 16:25         ` [Qemu-devel] Problem under OSX Lion: GThread-ERROR **: GThread system may only be initialized once Juan Pineda
2011-10-31 16:36           ` Daniel P. Berrange [this message]
2011-10-31 16:40             ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111031163604.GH27570@redhat.com \
    --to=berrange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=andreas.faerber@web.de \
    --cc=juan@logician.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).