multi thread app and often variable accessing



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



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