fixes #1551
This commit is contained in:
parent
8afb85b3d4
commit
6c9730b353
2 changed files with 8 additions and 3 deletions
|
|
@ -1614,6 +1614,11 @@ proc instantiateCreateFlowVarCall(c: PContext; t: PType;
|
||||||
initIdTable(bindings)
|
initIdTable(bindings)
|
||||||
bindings.idTablePut(sym.ast[genericParamsPos].sons[0].typ, t)
|
bindings.idTablePut(sym.ast[genericParamsPos].sons[0].typ, t)
|
||||||
result = c.semGenerateInstance(c, sym, bindings, info)
|
result = c.semGenerateInstance(c, sym, bindings, info)
|
||||||
|
# since it's an instantiation, we unmark it as a compilerproc. Otherwise
|
||||||
|
# codegen would fail:
|
||||||
|
if sfCompilerProc in result.flags:
|
||||||
|
result.flags = result.flags - {sfCompilerProc, sfExportC, sfImportC}
|
||||||
|
result.loc.r = nil
|
||||||
|
|
||||||
proc setMs(n: PNode, s: PSym): PNode =
|
proc setMs(n: PNode, s: PSym): PNode =
|
||||||
result = n
|
result = n
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ type
|
||||||
|
|
||||||
FlowVarBase* = ref FlowVarBaseObj ## untyped base class for 'FlowVar[T]'
|
FlowVarBase* = ref FlowVarBaseObj ## untyped base class for 'FlowVar[T]'
|
||||||
FlowVarBaseObj = object of TObject
|
FlowVarBaseObj = object of TObject
|
||||||
ready, usesCondVar: bool
|
ready, usesCondVar, awaited: bool
|
||||||
cv: CondVar #\
|
cv: CondVar #\
|
||||||
# for 'awaitAny' support
|
# for 'awaitAny' support
|
||||||
ai: ptr AwaitInfo
|
ai: ptr AwaitInfo
|
||||||
|
|
@ -129,8 +129,8 @@ type
|
||||||
proc await*(fv: FlowVarBase) =
|
proc await*(fv: FlowVarBase) =
|
||||||
## waits until the value for the flowVar arrives. Usually it is not necessary
|
## waits until the value for the flowVar arrives. Usually it is not necessary
|
||||||
## to call this explicitly.
|
## to call this explicitly.
|
||||||
if fv.usesCondVar:
|
if fv.usesCondVar and not fv.awaited:
|
||||||
fv.usesCondVar = false
|
fv.awaited = true
|
||||||
await(fv.cv)
|
await(fv.cv)
|
||||||
destroyCondVar(fv.cv)
|
destroyCondVar(fv.cv)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue