Apparent thread-safety bug in Glib 2.0 docs



I'm still learning GTK/Gnome/etc., so I've been perusing the
documentation. I was looking at the Glib documentation for threads:

http://developer.gnome.org/doc/API/2.0/glib/glib-Threads.html#id2941682

It lists 4 examples while talking about thread-safe code. Unfortunately,
the 3rd & 4th examples, though labeled as thread safe appear to not be
thread safe.

The problem that I'm perceiving is that the "current_number" variable is
not declared as volatile. While this might seem nit picky, without this
flag the compiler may very well generate incorrect code. Given that this
is a common programmer error, I think it'd be a good idea to either
elaborate this point in the documentation, or at least correct the
examples. Thoughts?

-- 
Christopher Smith <x xman org>



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