OSDN Git Service

Initialize art::Atomic's value to 0.
authorDan Albert <danalbert@google.com>
Tue, 12 Aug 2014 18:48:34 +0000 (11:48 -0700)
committerDan Albert <danalbert@google.com>
Tue, 12 Aug 2014 20:37:26 +0000 (13:37 -0700)
art::Mutex and art::ConditionVariable were DCHECKing that the value was
zero on entering the constructor without ever initializing the value.
Since 0 is a sensible default, make it the default for art::Atomic
rather than initializing for each use.

Bug: 16301104
Change-Id: I9c98b82c80670b7a6c53d46a08236bbed6a64f8f

runtime/atomic.h

index 5ddafb4..868f32c 100644 (file)
@@ -256,7 +256,7 @@ class QuasiAtomic {
 template<typename T>
 class Atomic : public std::atomic<T> {
  public:
-  Atomic<T>() : std::atomic<T>() { }
+  Atomic<T>() : std::atomic<T>(0) { }
 
   explicit Atomic<T>(T value) : std::atomic<T>(value) { }