summary refs log tree commit diff stats
path: root/tests/parallel/tdont_be_stupid.nim
blob: a7e82466ad7318f5ef3f73a241bc48ac45e46be6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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([50,3,40,25])