On 11/11/06, Tomasz Jankowski <[EMAIL PROTECTED]> wrote: > I looking for someone, who will say if my idea is bad or good ;) > I have an object based on GObject, which have quite many int variables. This > object is used by many threads and i'm wondering if I really need to use > mutex when I want to access those variables. Can I use atomically access to > int variables using g_atomic* functions instead using mutex? Is it a good > solution or it may occur memory access problems?
It will be much faster, but you can't use them in many cases. The big problem is if you have sevaral variables which have to change together, for example if you have an (x, y) coordinate pair. If you don't use a mutex, a writer thread could be only half way though updating the coordinate when a reader thread tests the values. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list