summary refs log blame commit diff stats
path: root/tests/parallel/tsysspawn.nim
blob: 7244a5ee663a66565353b0255bac6fb261c0dc86 (plain) (tree)
1
2
3
4
5
6
7
8


              
                                                

   

                 



          
                       

           
             

         
                       

           
                








               
discard """
  output: '''4
8'''
  cmd: "nim $target --threads:on $options $file"
"""

import threadpool

var
  x, y = 0

proc p1 =
  for i in 0 .. 10_000:
    discard

  atomicInc x

proc p2 =
  for i in 0 .. 10_000:
    discard

  atomicInc y, 2

for i in 0.. 3:
  spawn(p1())
  spawn(p2())

sync()

echo x
echo y