Skip to content

Instantly share code, notes, and snippets.

@ChrisCates
Last active April 25, 2017 19:48
Show Gist options
  • Save ChrisCates/fa7603d7b7a70cc13cb6e2dfb07e5324 to your computer and use it in GitHub Desktop.
Save ChrisCates/fa7603d7b7a70cc13cb6e2dfb07e5324 to your computer and use it in GitHub Desktop.
fileList := make(chan string, len(files))
done := make(chan int, availableCores)
for i := 0; i < availableCores; i++ {
go threadedRead(i, columns, fileList, done)
}
for i := 0; i < len(files); i++ {
fileList <- "sql_tmp/" + files[i].Name()
}
close(fileList)
for i := 0; i < len(files); i++ {
fmt.Println("Chunk #", i, "read")
<-done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment