[pypy-commit] stmgc use-gcc: This write_fence() was really needed, I think
arigo
noreply at buildbot.pypy.org
Tue Sep 1 19:23:30 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: use-gcc
Changeset: r1951:bba995bf44bc
Date: 2015-09-01 18:10 +0200
http://bitbucket.org/pypy/stmgc/changeset/bba995bf44bc/
Log: This write_fence() was really needed, I think
diff --git a/c8/stm/hashtable.c b/c8/stm/hashtable.c
--- a/c8/stm/hashtable.c
+++ b/c8/stm/hashtable.c
@@ -326,6 +326,12 @@
stm_allocate_preexisting(sizeof(stm_hashtable_entry_t),
(char *)&initial.header);
hashtable->additions++;
+ /* make sure .object is NULL in all segments before
+ "publishing" the entry in the hashtable. In other words,
+ the following write_fence() prevents a partially
+ initialized 'entry' from showing up in table->items[i],
+ where it could be read from other threads. */
+ write_fence();
}
table->items[i] = entry;
write_fence(); /* make sure 'table->items' is written here */
More information about the pypy-commit
mailing list