GNOME Bugzilla – Bug 604162
Enable threading by default
Last modified: 2009-12-09 14:38:12 UTC
There's no simple way to enable threading in a gjs application, apart from creating an external module which does it for you. As most applications require threads these days it makes sense to enable it by default. g_type_init() will soon enable thread initializating per default as well.
Created attachment 149418 [details] [review] Enable threading by default
Review of attachment 149418 [details] [review]: Shouldn't that call be placed before g_option_context_new() - as first glib call ever? And in similar fashion shouldn't setlocale be called before option parsing to get --help translated?
This is kind of useless if gjs itself isn't threadsafe, isn't it? We aren't doing proper locking at all, I don't think.
Tommi: Sure, I'll move it up and do it before everything else. Havoc: It's not useless at all, it makes it possible use libraries such as libsoup which require that glib threading is enabled. Note that the patch is not guaranteeing anything about the internals of gjs and how threading is expected to work, it's just enabling glib threading. Eventually if we want good GStreamer support we'd need to look into making gjs threadsafe, but that's a completely different bug.
oops, I didn't look at the patch ;-) thought it was enabling spidermonkey threading rather than glib threading. enabling glib threading makes sense.
The following fix has been pushed: 3185dfb Enable threading by default
Created attachment 149433 [details] [review] Enable threading by default There's no simple way to enable threading in a gjs application, apart from creating an external module which does it for you. As most applications require threads these days it makes sense to enable it by default. g_type_init() will soon enable thread initializating per default as well.