help-gplusplus
[Top][All Lists]
Advanced

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

Re: Protect a block of code from optimization?


From: Maxim Yegorushkin
Subject: Re: Protect a block of code from optimization?
Date: 2 Aug 2007 22:33:03 -0700
User-agent: G2/1.0

On 31 Jul, 19:44, chamric.spamma...@gmail.com wrote:
> I've got a bit of code in a multithreaded program that implements a
> non-blocking concurrent queue.  I want to optimize my code as much as
> possible because it must work in a high-performance environment, but
> I'm afraid of the optimization routines messing up the ordering of my
> queue code.
>
> Is there some kind of preprocessor line or something to instruct the
> optimizer to not optimize a certain section of code, but still be able
> to optimize the rest?

Sounds like you need memory barriers.
http://en.wikipedia.org/wiki/Memory_barrier
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]