Re: gdk threads ...

On Mon, 2012-03-05 at 14:07 +0000, Emmanuele Bassi wrote:
> On 5 March 2012 13:07, Ryan Lortie <desrt desrt ca> wrote:
> > The removal will come in GTK4.  There will be no replacement
> > functionality -- you will just be expected to do all your interaction
> > with the toolkit from the main thread (ie: dispatching results via
> > idles).

	Ryan: when you say "the main thread" - what does that mean ? does it
mean from "a single thread" - as in we need to guarentee that the calls
are only ever actually happening from a single thread at a time ? or
does it mean that you will get/check/assert/behave-differently if code
is executed if pthread_self() doesn't match[1] some magic,
pre-initialized variant ?

> AFAIR, the java-gnome bindings used the GDK threading markers to
> replace the mutex used internally by GDK with a recursive one, that
> suited the java programming model.
> also, Libre/OpenOffice chained up their Big Fat Lock™ to GDK's one.

	Right - it makes sense for apps whose toolkits traditionally look
thread-safe to try to hide this stuff from their long-suffering
users ;-)

> I guess we'll have to maintain the gdk_threads_set_lock_functions(),
> and internally use gdk_threads_enter()/_leave(), even if the API is
> not available in public headers.

	So - as I say, there are other potential ways to do something similar
if you don't want to have anything to do with locking. One option might
be to ensure that all toolkit using apps use a custom GMainContext, that
allows all source check / dispatch / etc. to be hooked, and some locking
inserted in between. That would need some considerable care to write and
new API of prolly more complexity than the existing enter/leave stuff.

	My question would be though - what is the benefit here ? removing code
is all well and good, and I do lots of it from week to week ;-) but it'd
be nice to know that there was some good reason / use for that, beyond a
vague feeling of cleanliness for toolkit authors ;-)



[1] - fwiw Qt was doing this in some places, and this was only just cut
out in the latest versions to avoid some funky LibreOffice crash/assert.
michael meeks suse com  <><, Pseudo Engineer, itinerant idiot

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