All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Maydell <peter.maydell@linaro.org>,
	"Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] glib: add g_thread_new() compat function
Date: Fri, 02 May 2014 15:16:18 +0400	[thread overview]
Message-ID: <53637E82.2080408@msgid.tls.msk.ru> (raw)
In-Reply-To: <CAFEAcA_evoqs27Mgz4F25ek4ojFO8CTnXJHNLCgKOWLNFo747A@mail.gmail.com>

02.05.2014 15:08, Peter Maydell wrote:

>>> Stefan Hajnoczi:
>>>> +#if !GLIB_CHECK_VERSION(2, 31, 0)
>>>> +static inline GThread *g_thread_new(const gchar *unused,
>>>> +                                    GThreadFunc func,
>>>> +                                    gpointer data)
>>>> +{
>>>> +    GThread *thread = g_thread_create(func, data, TRUE, NULL);
>>>> +    if (!thread) {
>>>> +        g_error("g_thread_create failed");
>>>> +    }
>>>> +    return thread;
>>>> +}
>>>> +#endif
>>>
>>> About g_error():
>>>
>>> "This function will result in a core dump; don't use it for errors you expect.
>>>  Using this function indicates a bug in your program, i.e. an assertion failure."

> I'm not convinced we should be emitting any kind of
> warning message here anyway -- surely it's up to the
> caller to handle thread creation failure? The glib
> warning/error functions presumably print to stderr,
> which has all the usual issues with possibly messing
> up guest output.

Note that QemuThread &Co has exactly the same issue.

void qemu_mutex_init(QemuMutex *mutex)
{
...
    if (err)
        error_exit(err, __func__);
}

and so on in all util/qemu-thread-{posix,win32).c

But yes, you're right, at least coroutine-gthread.c
appears to try to handle errors by its own.

So this is what's missing from my patchset for libcacard -
since this one replaces qemu thread primitives (which
aborts on error) with glib thread primitives (which
return error condition instead).

Thanks,

/mjt

  reply	other threads:[~2014-05-02 11:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02 10:52 [Qemu-devel] [PATCH 2/3] glib: add g_thread_new() compat function Michael Tokarev
2014-05-02 11:01 ` Daniel P. Berrange
2014-05-02 11:08   ` Peter Maydell
2014-05-02 11:16     ` Michael Tokarev [this message]
2014-05-02 12:30     ` Michael Tokarev
  -- strict thread matches above, loose matches on Subject: below --
2014-02-03 13:31 [Qemu-devel] [PATCH 0/3] glib: move compat functions into glib-compat.h Stefan Hajnoczi
2014-02-03 13:31 ` [Qemu-devel] [PATCH 2/3] glib: add g_thread_new() compat function Stefan Hajnoczi

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=53637E82.2080408@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.