summary refs log tree commit diff stats
path: root/tests/stdlib/tthreadpool.nim
blob: 1947074be11d4f05baa4fe3a9d00e8cd72513396 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
discard """
  matrix: "--mm:arc; --mm:refc"
  disabled: "freebsd"
  output: "42"
"""
import std/assertions
from std/threadpool import spawn, `^`, sync
block: # bug #12005
  proc doworkok(i: int) {.thread.} = echo i
  spawn(doworkok(42))
  sync() # this works when returning void!

  proc doworkbad(i: int): int {.thread.} = i
  doAssert ^spawn(doworkbad(42)) == 42 # bug was here