* remove unnecessary when statement * remove outdated codes * reuse jsffi * move js json coverage * close #12005 add testcase * Update tests/stdlib/tthreadpool.nim * Update tests/stdlib/tthreadpool.nim * Update tests/stdlib/tthreadpool.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
parent
93cb5d6896
commit
dd8383b10a
1 changed files with 14 additions and 0 deletions
14
tests/stdlib/tthreadpool.nim
Normal file
14
tests/stdlib/tthreadpool.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--threads:on --gc:arc"
|
||||||
|
disabled: "freebsd"
|
||||||
|
output: "42"
|
||||||
|
"""
|
||||||
|
|
||||||
|
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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue