Add spawn test. Hangs most of the time on linux x64 at least.
This commit is contained in:
parent
be6474af63
commit
a822d0bf01
1 changed files with 29 additions and 0 deletions
29
tests/system/tsysspawn.nim
Normal file
29
tests/system/tsysspawn.nim
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
discard """
|
||||||
|
output: '''4
|
||||||
|
8'''
|
||||||
|
cmd: "nimrod $target --threads:on $options $file"
|
||||||
|
"""
|
||||||
|
|
||||||
|
var
|
||||||
|
x, y = 0
|
||||||
|
|
||||||
|
proc p1 =
|
||||||
|
for i in 0 .. 1_000_000:
|
||||||
|
discard
|
||||||
|
|
||||||
|
inc x
|
||||||
|
|
||||||
|
proc p2 =
|
||||||
|
for i in 0 .. 1_000_000:
|
||||||
|
discard
|
||||||
|
|
||||||
|
inc y, 2
|
||||||
|
|
||||||
|
for i in 0.. 3:
|
||||||
|
spawn(p1())
|
||||||
|
spawn(p2())
|
||||||
|
|
||||||
|
sync()
|
||||||
|
|
||||||
|
echo x
|
||||||
|
echo y
|
||||||
Loading…
Add table
Add a link
Reference in a new issue