-
-
Save shybovycha/83004a4844924acee486fece73467b6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threadpool | |
# Array needs explicit size to work, probably related to issue #2287 | |
const a: array[0..5, int] = [1,2,3,4,5,6] | |
proc f(n) = echo "Hello ", n | |
proc main = | |
parallel: | |
for i in countup(0, a.high-1, 2): | |
spawn f(a[i]) | |
spawn f(a[i+1]) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment