From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgBE2-0001FL-6a for qemu-devel@nongnu.org; Fri, 02 May 2014 07:01:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgBDy-0007jr-CQ for qemu-devel@nongnu.org; Fri, 02 May 2014 07:01:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgBDy-0007jQ-4y for qemu-devel@nongnu.org; Fri, 02 May 2014 07:01:50 -0400 Date: Fri, 2 May 2014 12:01:41 +0100 From: "Daniel P. Berrange" Message-ID: <20140502110141.GQ22878@redhat.com> References: <536378E7.1090408@msgid.tls.msk.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <536378E7.1090408@msgid.tls.msk.ru> Subject: Re: [Qemu-devel] [PATCH 2/3] glib: add g_thread_new() compat function Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: qemu-devel , stefanha@redhat.com On Fri, May 02, 2014 at 02:52:23PM +0400, Michael Tokarev wrote: > Stefan Hajnoczi: > > Implement g_thread_new() in terms of the deprecated g_thread_create(). > > The API was changed in glib 2.31.0. > > > > The compat function allows us to write modern code and avoid ifdefs. > > ACK. With one small nit: > > [] > > +#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 sure if this is like an assertion failure, probably yes. But we should > not, I think, dump core in this situation. Is there a glib function that does > (fatal) error reporting but does NOT dump core? I think that's what g_critical is intended for. It is more severe than g_warning, but won't exit or abort the process. Regards, Daniel -- |: 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 :|