Re: Doubts about GThreads

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

 





On Tue, May 18, 2010 at 9:12 AM, Iñigo Martínez <martinez.i@xxxxxxxxx> wrote:

I mean, before waiting on a condition, is usual to lock the mutex used
on the condition, so if the thread is waiting and the mutex locked,
another thread will not be able to lock the same mutex to wake up the
thread with cond, blocking each other.

and to clarify this point: when a thread blocks ("sleeps") in order to wait for a condition, it releases the mutexes that was passed to g_cond_wait(). then, before it is woken again, the thread system reacquires the mutex on behalf of the thread, so that when it returns from g_cond_wait(), the mutex it held again.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux