tthreadheapviolation1.nim 369 B

12345678910111213141516171819
  1. discard """
  2. errormsg: "'horrible' is not GC-safe"
  3. line: 11
  4. cmd: "nim $target --hints:on --threads:on $options $file"
  5. """
  6. var
  7. global: string = "test string"
  8. t: Thread[void]
  9. proc horrible() {.thread.} =
  10. global = "string in thread local heap!"
  11. var x = global
  12. var mydata = (x, "my string too")
  13. echo global
  14. createThread[void](t, horrible)
  15. joinThread(t)