Re: Proposal: Enable threads by default



On Tue, 2009-12-01 at 16:16 -0500, Dan Winship wrote:
> On 12/01/2009 03:36 PM, Alexander Larsson wrote:
> > I don't think that is quite right. Its only safe to set this define
> if
> > you can guarantee there is no calls to your code before g_type_init
> (or
> > g_thread_init directly) is called.
> 
> Hrmph. Could potentially add a define which would cause a G_LIKELY()
> to be added in to G_THREAD_CF() when linking to gobject... but we'd want
> to test that it actually had a measurable effect first.

Actually, why are the thread primitives using g_thread_supported() at
all? They're all virtualized anyway, can't we just change the default
operation to be some non-NULL version that does what the 
!g_thread_supported case does?
 
> > I wouldn't mind this, but on the other hand its not really a large
> > maintainance burden, is it?
> 
> Continuing to maintain the existing code which we already know works
> is not a large burden, but having to write non-threaded versions of *new*
> APIs might suck (having to write *two* non-threaded versions of
> GResolver did) and then after we write them they're never going to get
> used and so they'll probably be all buggy anyway. And besides, who are
> we providing the no-thread-support version for anyway? There used to
> be some somewhat-relevant unixes without pthreads, but I don't think
> there are any non-toy OSes that have that problem any more.

I'm certainly for this. Does anyone know of any system in use where
gthreads are not availible?

Another aspect is that you might want to disable threads in e.g. an
embedded system where they are not used. I'm not sure people actually do
this though, since embedded systems large enough to run e.g. gtk or
other gobject things are generally big enough that you can support
threads and you're likely to actually want to use things like
threadpools and async i/o.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl redhat com            alexander larsson gmail com 
He's a lonely white trash assassin who dotes on his loving old ma. She's a 
vivacious foul-mouthed magician's assistant from the wrong side of the tracks. 
They fight crime! 



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