tracy_allocator.nim 461 B

1234567891011121314151617181920212223242526
  1. discard """
  2. output: '''true'''
  3. """
  4. var somethingElse {.threadvar.}: ref string
  5. type MyThread = Thread[void]
  6. proc asyncThread() {.thread.} =
  7. new somethingElse
  8. var threads = newSeq[ptr Thread[void]](8)
  9. for c in 1..1_000:
  10. #echo "Test " & $c
  11. for i in 0..<threads.len:
  12. var t = cast[ptr Thread[void]](alloc0(sizeof(MyThread)))
  13. threads[i] = t
  14. createThread(t[], asyncThread)
  15. for t in threads:
  16. joinThread(t[])
  17. dealloc(t)
  18. echo "true"