Re: glib >= 2.31.0 Threads and Mutexes

2011-11-14 Thread Jirka Klimes
On Monday 31 of October 2011 15:26:48 martin...@gmx.net wrote:
> Hello list!
> 
> There was a change in the threads and mutexes API in glib starting with
> version 2.31, see http://git.gnome.org/browse/glib/tree/NEWS. Especially
> g_thread_init(), g_thread_create(), g_mutex_new() and g_mutex_free() are
> gone.  I replaced those as follows:
> 
> - made g_thread_init conditional, as demonstrated in
> https://bugs.freedesktop.org/show_bug.cgi?id=42036. - conditionally
> replaced g_thread_create() with g_thread_new(). NetworkManager never
> catches errors and threads seem always joinable now, so the change is
> straight forward replace and satisfy g_thread_new() signature -
> g_mutex_new() replaced by static declarations of GMutex-es and
> (conditionally) passing their references where g_mutex_new() used to be
> called - g_mutex_free() removed (conditionally)
> 
> I came across this problem while building Gnome3 using jhbuild, so this
> patch should be against git HEAD (or its equivalent given a central
> repository).
> 
> Kind regards
> 
> Martin
>   
> 
>  

Fixed by this commit:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=4d1d3b9935fca45ff98e1e705ce74540d234c41b

Jirka
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: glib >= 2.31.0 Threads and Mutexes

2011-10-31 Thread Dan Winship
On 10/31/2011 10:26 AM, martin...@gmx.net wrote:
> Hello list!
> 
> There was a change in the threads and mutexes API in glib starting with 
> version 2.31, see http://git.gnome.org/browse/glib/tree/NEWS. Especially 
> g_thread_init(), g_thread_create(), g_mutex_new() and g_mutex_free() are 
> gone.  I replaced those as follows:
> 
> - made g_thread_init conditional, as demonstrated in 
> https://bugs.freedesktop.org/show_bug.cgi?id=42036.

g_thread_init() has been unnecessary since glib 2.24 in any program that
uses GObjects. NM claims to only require glib 2.18 right now... I don't
know if that's true or not.

> - g_mutex_new() replaced by static declarations of GMutex-es and 
> (conditionally) passing their references where g_mutex_new() used to be called

The right replacement is to replace

  GMutex *foo;
  ...
  foo = g_mutex_new ();
  ...
  g_mutex_lock (foo);
  ...
  g_mutex_free (foo);

with:

  GMutex foo;
  ...
  g_mutex_init (&foo);
  ...
  g_mutex_lock (&foo);
  ...
  g_mutex_clear (&foo);
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list