Skip to content

Instantly share code, notes, and snippets.

@shybovycha
Created March 26, 2017 12:14
Show Gist options
  • Save shybovycha/eca6e69a9d789cc36a363b26d2fdcc05 to your computer and use it in GitHub Desktop.
Save shybovycha/eca6e69a9d789cc36a363b26d2fdcc05 to your computer and use it in GitHub Desktop.
import strutils, threadpool
let a: array[10, int] = [1,2,3,4,5,5,6,4,3,2]
proc f(x:int) =
let s = intToStr(x)
echo s
proc main =
parallel:
var i = 0
while i <= a.high:
spawn f(a[i])
spawn f(a[i+1])
i += 2
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment