g_thread_init question

Hello all!

The docs on developer.gnome.org state that g_thread_init() will abort if
called twice and suggest the following construct to avoid multiple

  if (!g_thread_supported ()) g_thread_init (NULL);

Has nobody noticed that there's a race condition there?

If I make a class that internally uses threads and mutexes, how do I
protect myself against another class (not necessarily mine) created in
another thread (not necessarily under my control) also calling
g_thread_init() because it is also internally using gthread?

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