smallnest / chanx

unbounded chan
MIT License
431 stars 63 forks source link

Add Cancel method and Done chanel #10

Closed molon closed 9 months ago

molon commented 2 years ago

Although it is feasible to rely on close(ch.In) to cancel the process, it is necessary to ensure that close(ch.In) must be executed after ch.In<-v when using it. It is inconvenient, because the two may be in different goroutine. So I suggest providing additional channels to handle this.