summary refs log tree commit diff stats
path: root/tests/stdlib/tthreadpool.nim
blob: bc574faebd9b8d65cde8a50a811e1013370545de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
discard """
  matrix: "--threads:on --gc:arc"
  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