Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r74443:9cebce388452
Date: 2014-11-11 14:32 +0100
http://bitbucket.org/pypy/pypy/changeset/9cebce388452/
Log: tweak _stm.count()
diff --git a/pypy/module/_stm/count.py b/pypy/module/_stm/count.py
--- a/pypy/module/_stm/count.py
+++ b/pypy/module/_stm/count.py
@@ -6,7 +6,8 @@
def count(space):
- """Return a new integer every time it is called,
-without generating conflicts."""
+ """Return a different positive integer every time it is called.
+This works without generating conflicts. The returned integers are
+only roughly in increasing order; this should not be relied upon."""
count = rstm.stm_count()
return space.wrap(count)
diff --git a/rpython/translator/stm/src_stm/stmgcintf.c
b/rpython/translator/stm/src_stm/stmgcintf.c
--- a/rpython/translator/stm/src_stm/stmgcintf.c
+++ b/rpython/translator/stm/src_stm/stmgcintf.c
@@ -224,6 +224,6 @@
long _pypy_stm_count(void)
{
- static long value = 0;
+ static long value = 1;
return __sync_fetch_and_add(&value, 1);
}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit