mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
* add acyclic pragmas to FlowVar * add testcases
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user