Re: Gnome/Gtk and thread safety



Maciej Stachowiak <mjs eazel com> writes:

> Havoc Pennington <hp redhat com> writes:
> 
> > Maciej Stachowiak <mjs eazel com> writes: 
> > > Oh my goodness, using global variables or function-scope statics
> > > concurrently from multiple threads without locking is not threadsafe?
> > > Have you published a paper on this new discovery yet? :-)
> > > 
> > 
> > Well, people don't want to use explicit locks dude. ;-)
> > 
> 
> Yes, but this problem is not really specific to Gtk+. You can't use
> global variables without a mutex for the variable, period; the
> `gtk_widget_new' call is a red herring. Anyone who wants to use
> threads understands basic concepts like that, I think, and I don't
> believe anyone expects Gtk+ to lock their global variables for them.

I think Havoc picked a bad example to start with; a better
example might be gtk_widget_get_toplevel(), or perhaps even
better gtk_window_list_toplevels().

Regards,
                                        Owen




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