Hi guys today I would like to ask you to help see the code. I would like to make the application multithreaded. How can i do this? here is the code
I have this structure.
type Sre struct {
Name string `json:"Namesre"`
Url string `json:"Url"`
P_name string `json:"P_name"`
P_email string `json:"P_email"`
Other string `json:"Other_params"`
Create string `json:"Create"`
Base string `json:"Base"`
}
type Settings struct {
Sres []Sre
}
var settings Settings
ok. And I have for example 100 elements settings.Sres[100]
In the normal case, I would use the for loop and go through all the elements in turn. Well, how to implement it using multithreading ?
for i := 0; i < len(settings.Sres); i++ {
go Other(settings.Sres[I].Name,
settings.Sres[I].Url,
settings.Sres[I].P_name,
settings.Sres[I].P_email,
settings.Sres[I].Other,
settings.Sres[I].Create,
settings.Sres[I].Base)
}
func Other{param1 string, param2 string, param3 string, param4 string, param5 string, param6 string,param7 string
{
....
....
....
}
Please tell me how I can create 100 threads execute to process all elements (settings.Sres [100]) in the Other function simultaneously in 100 threads