diff options
| -rw-r--r-- | runtime/base/locks.cc | 2 | ||||
| -rw-r--r-- | runtime/base/mutex.cc | 2 | ||||
| -rw-r--r-- | runtime/thread_pool.h | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/runtime/base/locks.cc b/runtime/base/locks.cc index 2c6b96892b..2c10bfd700 100644 --- a/runtime/base/locks.cc +++ b/runtime/base/locks.cc @@ -93,7 +93,7 @@ static void BackOff(uint32_t i) { volatile uint32_t x = 0; const uint32_t spin_count = 10 * i; for (uint32_t spin = 0; spin < spin_count; ++spin) { - ++x; // Volatile; hence should not be optimized away. + x = x + 1; // Volatile; hence should not be optimized away. } // TODO: Consider adding x86 PAUSE and/or ARM YIELD here. } else if (i <= kYieldMax) { diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc index 831c53599d..0abe9667f8 100644 --- a/runtime/base/mutex.cc +++ b/runtime/base/mutex.cc @@ -109,7 +109,7 @@ static void BackOff(uint32_t i) { volatile uint32_t x = 0; const uint32_t spin_count = 10 * i; for (uint32_t spin = 0; spin < spin_count; ++spin) { - ++x; // Volatile; hence should not be optimized away. + x = x + 1; // Volatile; hence should not be optimized away. } // TODO: Consider adding x86 PAUSE and/or ARM YIELD here. } else if (i <= kYieldMax) { diff --git a/runtime/thread_pool.h b/runtime/thread_pool.h index 6d176546c3..96317ad13d 100644 --- a/runtime/thread_pool.h +++ b/runtime/thread_pool.h @@ -192,10 +192,10 @@ class AbstractThreadPool { Mutex task_queue_lock_; ConditionVariable task_queue_condition_ GUARDED_BY(task_queue_lock_); ConditionVariable completion_condition_ GUARDED_BY(task_queue_lock_); - volatile bool started_ GUARDED_BY(task_queue_lock_); - volatile bool shutting_down_ GUARDED_BY(task_queue_lock_); + bool started_ GUARDED_BY(task_queue_lock_); + bool shutting_down_ GUARDED_BY(task_queue_lock_); // How many worker threads are waiting on the condition. - volatile size_t waiting_count_ GUARDED_BY(task_queue_lock_); + size_t waiting_count_ GUARDED_BY(task_queue_lock_); std::vector<ThreadPoolWorker*> threads_; // Work balance detection. uint64_t start_time_ GUARDED_BY(task_queue_lock_); |