From 795a7762ccf387140a6fa6d2a8964cb0654a3732 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 9 Dec 2014 01:03:56 +0100 Subject: minor improvement to the barrier implementation --- compiler/platform.nim | 2 +- lib/pure/concurrency/threadpool.nim | 4 +++- todo.txt | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/platform.nim b/compiler/platform.nim index 2e78d4fc5..c6cb3d244 100644 --- a/compiler/platform.nim +++ b/compiler/platform.nim @@ -1,6 +1,6 @@ # # -# The Nimrod Compiler +# The Nim Compiler # (c) Copyright 2012 Andreas Rumpf # # See the file "copying.txt", included in this diff --git a/lib/pure/concurrency/threadpool.nim b/lib/pure/concurrency/threadpool.nim index 28ef25d95..0bd97043a 100644 --- a/lib/pure/concurrency/threadpool.nim +++ b/lib/pure/concurrency/threadpool.nim @@ -65,7 +65,9 @@ proc barrierEnter(b: ptr Barrier) {.compilerProc, inline.} = proc barrierLeave(b: ptr Barrier) {.compilerProc, inline.} = atomicInc b.left when not defined(x86): fence() - if b.interest and b.left == b.entered: signal(b.cv) + # We may not have seen the final value of b.entered yet, + # so we need to check for >= instead of ==. + if b.interest and b.left >= b.entered: signal(b.cv) proc openBarrier(b: ptr Barrier) {.compilerProc, inline.} = b.entered = 0 diff --git a/todo.txt b/todo.txt index 6068c049b..5b0d00e16 100644 --- a/todo.txt +++ b/todo.txt @@ -3,7 +3,10 @@ version 0.10 Repetition renders the ridiculous reasonable. -- introduce ``--experimental`` switch +- document 'converter' +- document the tables module better + + - c2nim depends on the compiler - make nimble part of the distribution - split idetools into separate tool -- cgit 1.4.1-2-gfad0