]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use atomic int for millisecond-based Balance instead of atomic int64_t.
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 3 Oct 2011 20:19:24 +0000 (14:19 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 3 Oct 2011 20:19:24 +0000 (14:19 -0600)
Atomic int64_t may cause "undefined reference to __sync_fetch_and_add_8"
linking errors, due to GCC bugs. Those errors can be fixed by building with
CXXFLAGS='-march=i586' but there is no reason to introduce that complexity
as 2^31 milliseconds is 35791 hours which is still plenty for our purposes.

src/ipc/Queue.h

index 021b87a43ac1545ae9c281a7e7191fa2605b7ab1..20986103d9aef628842aa38f5c868bb702e0cd58 100644 (file)
@@ -49,7 +49,8 @@ public:
     typedef AtomicWord Rate; ///< pop()s per second
     Rate rateLimit; ///< pop()s per second limit if positive
 
-    typedef AtomicWordT<int64_t> AtomicSignedMsec;
+    // we need a signed atomic type because balance may get negative
+    typedef AtomicWordT<int> AtomicSignedMsec;
     typedef AtomicSignedMsec Balance;
     /// how far ahead the reader is compared to a perfect read/sec event rate
     Balance balance;