Print

Print


Hi Andy,

The proposal about the atomics sounds good to me.

The rest of the patch had a pretty screwy git history (branched off xrootd.org before the move to github), so I squashed it to here:

https://github.com/bbockelm/xrootd-1/tree/throttles_v4

then rebased onto the latest master.

NOTE NOTE: while the atomics need to be fixed, the compiler noticed the fix here doesn't work right.  See this instead:  https://github.com/bbockelm/xrootd-1/commit/0f378e2d3a213dec1a7bfc322bf17db156508c86#diff-8a75f4c4575d9cf9cb6d982396d73258L52

The piece which doesn't work is around "if" statements like:

if (foo) AtomicAdd(x, y)

If atomics are not supported, this is expanded to:

if (foo) x; x += y

which is something completely different.  I dislike the use of templates, but I think only something like this will work:

```
template<typename T, typename U> T AtomicAdd(T &x, const U y) {T tmp = x; x += y; return tmp;}
```

(and then hope the compiler is smart enough to inline!)

Brian

---
Reply to this email directly or view it on GitHub:
https://github.com/xrootd/xrootd/pull/22#issuecomment-51653935

########################################################################
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