Answer the question
In order to leave comments, you need to log in
Is it possible to send different channels to a function?
The essence is as follows: there is a function, a goroutine (f2) that takes two channels, performs some actions and writes the results to these channels. There is a function, a goroutine (f1) to which data is transferred and it must create different channels and transfer them to f2, then it waits for responses from these channels, receives and processes them further. So if I just create a channel in f2 and these goroutines will be several, then different ones will take different channels? How can I make sure everyone listens to their own channel?
Answer the question
In order to leave comments, you need to log in
Well, for example, like this:
func runGoRoutine1(input chan bool) {
go func() {
data:= <-input
...
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question