Hi, As far as I understand, g_atomic_int_get/set will do the job just fine, as long as you're sure the only part that needs to be atomic is the getting and setting. However, if the hardware you are running on does not provide an atomic way of getting/setting an int, (eg: int is an int32 and the hardware is 8-bit), you will end up locking and unlocking mutexes anyways (but most systems nowadays are 32bit+ anyways)
Jonathan On 6/8/07, Tomasz Jankowski <[EMAIL PROTECTED] > wrote: > > Hi! > > I'm working on small multi thread application based on Gobject. In one of > my > objects I have integer variable, which determine current object's status. > The problem is, that I need to read it's status really often, so it will > be > to expensive to lock and unlock mutex all the time. Can I use there atomic > operations provided by GLib instead of mutex locking and unlocking system? > I > mean, if g_atomic_get and g_atomic_set would not occur any problems, when > I > will try to access the same variable from two thread at the same time? > > -- > Cya! > Tom > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list