hi;

On 6 December 2011 18:14, Tristan Van Berkom <t...@gnome.org> wrote:
> Or, can glib programs which don't make use of GObject use
> threads at all ?

sure.

> Must _those_ programs still call g_thread_init()
> before using threads ?

before GLib 2.31, yes; after, no.

> It seems that the pthread library itself requires at least that pthread_init()
> be called once before using threads, is it called implicitly by every
> function that might require threads ? (like g_mutex_init() ?)

threading support is always initialized, in GLib 2.31.

> Speaking of which, I just stumbled on some really odd documentation
> for g_mutex_init(), it says there:
>
>   "It is not necessary to initialize a mutex that has been created
> that has been statically allocated."
>
> Anyone care to mention what that means ? Mustn't a mutex at least be
> zero initialized if
> declared on the stack ? i.e. GMutex my_mutex = { 0, }; ?

if it's in static storage, i.e. it has been declared as:

  static GMutex my_mutex;

then no, you don't need to initialize it, as the C spec defines that
the static storage has to be zero-initialized.

if it's been placed inside a struct or union, then yes: you need to
explicitly initialize it using g_mutex_init().

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  • mutex doubt Marcelo Elias Del Valle - SYSMAP SOLUTIONS - Claro MA-SP -
    • Re: mutex ... jcupitt
      • Re: mu... Tristan Van Berkom
        • Re... Emmanuele Bassi
          • ... Marcelo Elias Del Valle - SYSMAP SOLUTIONS - Claro MA-SP -
            • ... Tristan Van Berkom
              • ... Marcelo Elias Del Valle - SYSMAP SOLUTIONS - Claro MA-SP -
        • RE... Marcelo Elias Del Valle - SYSMAP SOLUTIONS - Claro MA-SP -
          • ... Marcelo Elias Del Valle - SYSMAP SOLUTIONS - Claro MA-SP -

Reply via email to