If you want to close a specified one of several collaborators, you can use Context to control it. If you want to close a specified one, do you still use Context?

whether this situation can only be judged by sync.Map and Channel

.

first, you need to close one of them. If the outside of your program can find the co-program you need to close, you need to inject some identification or something, such as using map to store these identities. Each co-program injects a channel, and then uses select to run inside the co-program to determine whether the channel is close. If close is off, exit the co-program ~

.
Menu