* add acyclic pragmas to FlowVar * add testcases
This commit is contained in:
parent
dac5a56d70
commit
2848cdb18a
2 changed files with 12 additions and 3 deletions
|
|
@ -102,7 +102,7 @@ type
|
|||
idx: int
|
||||
|
||||
FlowVarBase* = ref FlowVarBaseObj ## Untyped base class for `FlowVar[T] <#FlowVar>`_.
|
||||
FlowVarBaseObj = object of RootObj
|
||||
FlowVarBaseObj {.acyclic.} = object of RootObj
|
||||
ready, usesSemaphore, awaited: bool
|
||||
cv: Semaphore # for 'blockUntilAny' support
|
||||
ai: ptr AwaitInfo
|
||||
|
|
@ -111,7 +111,7 @@ type
|
|||
# be RootRef here otherwise the wrong GC keeps track of it!
|
||||
owner: pointer # ptr Worker
|
||||
|
||||
FlowVarObj[T] = object of FlowVarBaseObj
|
||||
FlowVarObj[T] {.acyclic.} = object of FlowVarBaseObj
|
||||
blob: T
|
||||
|
||||
FlowVar*[T] {.compilerproc.} = ref FlowVarObj[T] ## A data flow variable.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ done999 999
|
|||
'''
|
||||
"""
|
||||
|
||||
import threadpool
|
||||
import std/[threadpool, os]
|
||||
|
||||
proc foo(): int = 999
|
||||
|
||||
|
|
@ -17,3 +17,12 @@ proc main =
|
|||
echo "done", f, " ", b
|
||||
|
||||
main()
|
||||
|
||||
# bug #13781
|
||||
proc thread(): string =
|
||||
os.sleep(1000)
|
||||
return "ok"
|
||||
|
||||
var fv = spawn thread()
|
||||
sync()
|
||||
doAssert ^fv == "ok"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue