Commit c302137 Fabien Coelho
committed
1 parent 49c12fd commit c302137 Copy full SHA for c302137
File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -670,7 +670,7 @@ def run():
670
670
barrier .wait ()
671
671
for s in ls :
672
672
for n in li :
673
- barrier .wait ()
673
+ # barrier.wait()
674
674
assert banged (s , n ) == s * n + "!"
675
675
barrier .wait ()
676
676
log .debug (f"thread end: { name } " )
@@ -684,7 +684,9 @@ def run():
684
684
assert len (cache ) == 32
685
685
# 16 * 2 gets-no-hit + 16 * (nthreads - 1) get-with-hit
686
686
hits = (nthreads - 1 ) / (nthreads + 1 )
687
- # NOTE hit ratio is not deterministic
687
+ # NOTE hit ratio is not deterministic: two thread may "get" at the same
688
+ # time, intercept the missing exception, compute the value and "set" it in cache.
689
+ # the failed "get" does not keep the lock to prevent that.
688
690
assert 0.75 * hits < cache .hits () <= hits
689
691
690
692
def test_threads ():
You can’t perform that action at this time.
0 commit comments