aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/index.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-01-16 20:43:25 +0100
committerSverker Eriksson <[email protected]>2017-01-16 20:43:25 +0100
commit228e34eb3eb75dd0cac1c7137861ee4a7b5b3f69 (patch)
tree78e7b800eb387aeceb9a6e9bc3dc0500fdad4479 /erts/emulator/beam/index.c
parente4f93595aba76c2eda2d2efef175ea9d72ee5d29 (diff)
parentbca5bf5a2d68a0e9ca681363a8943809c4751950 (diff)
downloadotp-228e34eb3eb75dd0cac1c7137861ee4a7b5b3f69.tar.gz
otp-228e34eb3eb75dd0cac1c7137861ee4a7b5b3f69.tar.bz2
otp-228e34eb3eb75dd0cac1c7137861ee4a7b5b3f69.zip
Merge branch 'maint-19' into maint
Diffstat (limited to 'erts/emulator/beam/index.c')
-rw-r--r--erts/emulator/beam/index.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/erts/emulator/beam/index.c b/erts/emulator/beam/index.c
index c86a2122f6..cd834e2c12 100644
--- a/erts/emulator/beam/index.c
+++ b/erts/emulator/beam/index.c
@@ -91,9 +91,16 @@ index_put_entry(IndexTable* t, void* tmpl)
t->seg_table[ix>>INDEX_PAGE_SHIFT] = erts_alloc(t->type, sz);
t->size += INDEX_PAGE_SIZE;
}
- t->entries++;
p->index = ix;
t->seg_table[ix>>INDEX_PAGE_SHIFT][ix&INDEX_PAGE_MASK] = p;
+
+ /*
+ * Do a write barrier here to allow readers to do lock free iteration.
+ * erts_index_num_entries() does matching read barrier.
+ */
+ ERTS_SMP_WRITE_MEMORY_BARRIER;
+ t->entries++;
+
return p;
}