This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization of conditional access to globals: thread-unsafe?
I accidentally removed the essential line, it should be:
On Tue, Oct 30, 2007 at 10:44:52 +0300, Tomash Brechko wrote:
> static volatile int __gthread_active = -1;
>
> ...
int __gthread_active_latest_value = __gthread_active;
> /* This test is not protected to avoid taking a lock on the main code
> path so every update of __gthread_active in a threaded program must
> be atomic with regard to the result of the test. */
> if (__builtin_expect (__gthread_active_latest_value < 0, 0))
> {
> ...
But you knew it already ;).
--
Tomash Brechko