Clang doesn't support the Lock Prefix. How shall I workaround?

Posted by Niels P. on Stack Overflow See other posts from Stack Overflow or by Niels P.
Published on 2010-05-29T17:54:03Z Indexed on 2010/05/29 18:02 UTC
Read the original article Hit count: 126

Filed under:
|
|

Assume this code:

  static inline void inc(int64_t* atomic)
  {
    __asm__ __volatile__
    (
      "lock incq %0\n"
        : "=m" (*atomic)
        : "m" (*atomic)
    );
  }

The Clang compiler doesn't support the lock prefix (yet?). What shall I do now?

© Stack Overflow or respective owner

Related posts about c++

Related posts about assembler