Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: runtime/vm/class_table.h

Issue 2602123002: Fix the following tsan errors: (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/class_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_table.h
diff --git a/runtime/vm/class_table.h b/runtime/vm/class_table.h
index b1721ed903420f36dd2eb376d45da562efad2499..1edb248b64d10c360d8c8568640fa11915e2dc50 100644
--- a/runtime/vm/class_table.h
+++ b/runtime/vm/class_table.h
@@ -6,6 +6,7 @@
#define RUNTIME_VM_CLASS_TABLE_H_
#include "platform/assert.h"
+#include "vm/atomic.h"
#include "vm/bitfield.h"
#include "vm/globals.h"
@@ -36,8 +37,8 @@ class AllocStats {
}
void AddNew(T size) {
- new_count++;
- new_size += size;
+ AtomicOperations::IncrementBy(&new_count, 1);
+ AtomicOperations::IncrementBy(&new_size, size);
}
void ResetOld() {
@@ -46,8 +47,8 @@ class AllocStats {
}
void AddOld(T size, T count = 1) {
- old_count += count;
- old_size += size;
+ AtomicOperations::IncrementBy(&old_count, count);
+ AtomicOperations::IncrementBy(&old_size, size);
}
void Reset() {
« no previous file with comments | « no previous file | runtime/vm/class_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698