summary refs log tree commit diff stats
path: root/tests/parallel/tdont_be_stupid.nim
blob: d765c11a90114f3b1417f51baaf3e466a3464add (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
discard """
output: '''
100
200
300
400
'''
"""

import threadpool, os

proc single(time: int) =
  sleep time
  echo time

proc sleepsort(nums: openArray[int]) =
  parallel:
    var i = 0
    while i <= len(nums) + -1:
      spawn single(nums[i])
      i += 1

sleepsort([400,100,300,200])