Is there an article that says not to use sync.Cond ? This page seems to have some fans of sync.Cond. I have xtensive software experience but I am new to golang so I am just trying to learn
https://github.com/golang/go/issues/21165 On Thursday, July 18, 2024 at 9:33:57 PM UTC-4 王旭东 wrote: > Hi, > It’s better to not use sync.Cond. Instead, use a channel to do a jame job. > There is even a issue to discuss remove it. > > 在2024年7月19日星期五 UTC+8 04:07:26<Robert Engels> 写道: > >> But I think that Done() is for the outer which prevents the broadcast. By >> putting it in the defer all of the subscribers should be waiting on the >> condition when it occurs. >> >> Caveat- not looking at code - just remembering. >> >> On Jul 18, 2024, at 3:01 PM, Lammie Jonson <jrub...@gmail.com> wrote: >> >> >> >> >> >> defer goroutineRunning.Done() >> >> This doesn't work. Each invocation of subscribe() has it's own >> sync.WaitGroup. It's just used it appears to ensure that the enclosed >> goroutine is running before subscribe() returns >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com. >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/45f26b0d-e00d-47e6-aede-ee9a70bb7d5dn%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/45f26b0d-e00d-47e6-aede-ee9a70bb7d5dn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/05375dce-9ea0-4d6d-808a-7f1f09134bc9n%40googlegroups.com.