summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-10-11 12:25:15 +0200
committerAraq <rumpf_a@web.de>2014-10-11 12:25:15 +0200
commit6c9730b3534927ac2bdd4ec7c77e0d37bba7aa2e (patch)
treef2c64a84d968861918b94cc23e0517b6842e5887 /lib/pure
parent8afb85b3d42b45509c78aa38a6009766cfe371f2 (diff)
downloadNim-6c9730b3534927ac2bdd4ec7c77e0d37bba7aa2e.tar.gz
fixes #1551
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/concurrency/threadpool.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/concurrency/threadpool.nim b/lib/pure/concurrency/threadpool.nim
index e0a2ac678..f46822d94 100644
--- a/lib/pure/concurrency/threadpool.nim
+++ b/lib/pure/concurrency/threadpool.nim
@@ -95,7 +95,7 @@ type
 
   FlowVarBase* = ref FlowVarBaseObj ## untyped base class for 'FlowVar[T]'
   FlowVarBaseObj = object of TObject
-    ready, usesCondVar: bool
+    ready, usesCondVar, awaited: bool
     cv: CondVar #\
     # for 'awaitAny' support
     ai: ptr AwaitInfo
@@ -129,8 +129,8 @@ type
 proc await*(fv: FlowVarBase) =
   ## waits until the value for the flowVar arrives. Usually it is not necessary
   ## to call this explicitly.
-  if fv.usesCondVar:
-    fv.usesCondVar = false
+  if fv.usesCondVar and not fv.awaited:
+    fv.awaited = true
     await(fv.cv)
     destroyCondVar(fv.cv)