fixes #1188
This commit is contained in:
parent
c7e77edecc
commit
bebda3851f
3 changed files with 15 additions and 6 deletions
|
|
@ -65,7 +65,7 @@ proc addLocalVar(g: ModuleGraph; varSection, varInit: PNode; owner: PSym; typ: P
|
||||||
vpart.sons[2] = if varInit.isNil: v else: vpart[1]
|
vpart.sons[2] = if varInit.isNil: v else: vpart[1]
|
||||||
varSection.add vpart
|
varSection.add vpart
|
||||||
if varInit != nil:
|
if varInit != nil:
|
||||||
if useShallowCopy and typeNeedsNoDeepCopy(typ):
|
if useShallowCopy and typeNeedsNoDeepCopy(typ) or optNimV2 in g.config.globalOptions:
|
||||||
varInit.add newFastAsgnStmt(newSymNode(result), v)
|
varInit.add newFastAsgnStmt(newSymNode(result), v)
|
||||||
else:
|
else:
|
||||||
let deepCopyCall = newNodeI(nkCall, varInit.info, 3)
|
let deepCopyCall = newNodeI(nkCall, varInit.info, 3)
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,10 @@ proc `^`*[T](fv: FlowVar[ref T]): ref T =
|
||||||
## Blocks until the value is available and then returns this value.
|
## Blocks until the value is available and then returns this value.
|
||||||
blockUntil(fv)
|
blockUntil(fv)
|
||||||
let src = cast[ref T](fv.data)
|
let src = cast[ref T](fv.data)
|
||||||
deepCopy result, src
|
when defined(nimV2):
|
||||||
|
result = src
|
||||||
|
else:
|
||||||
|
deepCopy result, src
|
||||||
finished(fv)
|
finished(fv)
|
||||||
|
|
||||||
proc `^`*[T](fv: FlowVar[T]): T =
|
proc `^`*[T](fv: FlowVar[T]): T =
|
||||||
|
|
@ -259,7 +262,10 @@ proc `^`*[T](fv: FlowVar[T]): T =
|
||||||
blockUntil(fv)
|
blockUntil(fv)
|
||||||
when T is string or T is seq:
|
when T is string or T is seq:
|
||||||
let src = cast[T](fv.data)
|
let src = cast[T](fv.data)
|
||||||
deepCopy result, src
|
when defined(nimV2):
|
||||||
|
result = src
|
||||||
|
else:
|
||||||
|
deepCopy result, src
|
||||||
else:
|
else:
|
||||||
result = fv.blob
|
result = fv.blob
|
||||||
finished(fv)
|
finished(fv)
|
||||||
|
|
|
||||||
|
|
@ -136,9 +136,12 @@ else:
|
||||||
when TArg is void:
|
when TArg is void:
|
||||||
thrd.dataFn()
|
thrd.dataFn()
|
||||||
else:
|
else:
|
||||||
var x: TArg
|
when defined(nimV2):
|
||||||
deepCopy(x, thrd.data)
|
thrd.dataFn(thrd.data)
|
||||||
thrd.dataFn(x)
|
else:
|
||||||
|
var x: TArg
|
||||||
|
deepCopy(x, thrd.data)
|
||||||
|
thrd.dataFn(x)
|
||||||
finally:
|
finally:
|
||||||
afterThreadRuns()
|
afterThreadRuns()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue