Re: When to call g_thread_init(), again...



On Fri, 2008-08-15 at 01:51 -0700, Brian J. Tarricone wrote:
> On Fri, 15 Aug 2008 10:58:59 +0300 Tor Lillqvist wrote:
> > ... Should ORBit2 g_error() out if
> > it notices that it wants to use threads but g_thread_init() has not
> > been called, instead of calling it itself?
> 
> Yes to that last bit.  If it really truly does matter that
> g_thread_init() be called before other glib functions, then no *library*
> should *ever* call g_thread_init().  If a library needs it, it should
> check g_thread_supported(), and g_error() with a useful error message
> if it fails.
> 
> That way, the programmer of the app knows the first time they test-run
> their app that they've done it wrong.

That sounds very sensible.

At the very least across the rest of the GNOME stack, but if it's a
behaviour change we want to encourage not just there but beyond, I
wonder how could we go about incenting library authors to adopt this
pattern?

AfC
Sydney

Attachment: signature.asc
Description: This is a digitally signed message part



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