Hello mates, I am trying to implement two for loops that run in one thread each. My background is in c++ (image processing). In c++ I can start a thread for each for loop, therefore each for, inside the same main function, concurs with the other one. Below the summarized code:
import (
"fmt"
"os"
"sync"
"github.com/antonel/owe-sdk-go/v1"
"github.com/joho/godotenv"
)
func main() {
//I would like to start the thread 1 here
for i := 0; i < 1000; i++ {
Work(node 1/port8080)
}
//Start the second thread here
for i := 0; i < 1000; i++ {
Work(node 2/port7070)
}
}
I found the examples about WaitGroup/go func, but it looks like work only inside the loop not for different for loops, for least it is what I understood. Please I need some help.