For x86_64 the assembler code is the same for both int and long long/int64_t.

The details on __sync_lock_test_and_set don't seem too reassuring when it comes to support for this.

type __sync_lock_test_and_set (type *ptr, type value, ...)
  This builtin, as described by Intel, is not a traditional test-and-set operation, 
  but rather an atomic exchange operation. It writes value into *ptr, and returns the 
  previous contents of *ptr.

  Many targets have only minimal support for such locks, and do not support a full 
  exchange operation. In this case, a target may support reduced functionality here
  by which the only valid value to store is the immediate constant 1. The exact value
  actually stored in *ptr is implementation defined.

  This builtin is not a full barrier, but rather an acquire barrier. This means that 
  references after the builtin cannot move to (or be speculated to) before the builtin, 
  but previous memory stores may not be globally visible yet, and previous memory 
  loads may not yet be satisfied. 

And it's not in the XrdSysAtomics.hh header file. I tried to stick to what was available there.


Reply to this email directly or view it on GitHub.



Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1