tags:

views:

1222

answers:

3

I saw an answer to a question regarding timing which used __sync_synchronize().

  • What does this function do?
  • And when is it necessary to be used?
+1  A: 

It forces a memory fence I guess.

Nikolai N Fetissov
+4  A: 

It is a atomic builtin for full memory barrier.

No memory operand will be moved across the operation, either forward or backward. Further, instructions will be issued as necessary to prevent the processor from speculating loads across the operation and from queuing stores after the operation.

Check details on the link above.

nik
A: 

Note not implemented on all platforms and silently does nothing when not implemented. Found this out the hard way on ARM...

Blank Xavier