summary refs log tree commit diff stats
path: root/tests/async/t15804.nim
blob: 8de012196fa6a033893c91884cef85d55539f535 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import asyncdispatch

type
  Foo*[E] = ref object 
    op: proc(): Future[bool] {.gcsafe.}

proc newFoo*[E](): Foo[E] =
  result = Foo[E]()
  result.op = proc(): Future[bool] {.gcsafe,async.} =
    await sleepAsync(100)
    result = false

when isMainModule:
  let f = newFoo[int]()
  echo waitFor f.op()