tthreadpool.nim 380 B

123456789101112131415
  1. discard """
  2. matrix: "--mm:arc; --mm:refc"
  3. disabled: "freebsd"
  4. output: "42"
  5. """
  6. import std/assertions
  7. from std/threadpool import spawn, `^`, sync
  8. block: # bug #12005
  9. proc doworkok(i: int) {.thread.} = echo i
  10. spawn(doworkok(42))
  11. sync() # this works when returning void!
  12. proc doworkbad(i: int): int {.thread.} = i
  13. doAssert ^spawn(doworkbad(42)) == 42 # bug was here