tracy_allocator.nim 478 B

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