This video is well worth watching, pausing and rewinding as required. It's 
Bryan C. Mills "Rethinking Classical Concurrency Patterns":
https://www.youtube.com/watch?v=5zXAHh5tJqQ

It shows patterns which are tricky to implement correctly with condition 
variables and semaphores can be cleanly implemented with channels. It also 
shows a Go replacement for the traditional "worker pool" pattern.

On Friday 19 July 2024 at 22:16:18 UTC+1 Kurtis Rader wrote:

> On Fri, Jul 19, 2024 at 2:05 PM Laurence Guild <massr...@gmail.com> wrote:
>
>> well, if I am trying to learn golang then I may need examples of how to 
>> use sync.Cond, but it's good to know that it may have problems. If you have 
>> an interview then people may ask you questions and if you haven't tried to 
>> use some feature or haven't played with it then you may feel like you don't 
>> fully understand things and it can effect your feeling of confidence 
>>
>
> It's not that using sync.Cond "may have problems." Used correctly a 
> sync.Cond works fine in Go. It's that, as Ian said, sync.Cond is rarely 
> needed in Go programs and using a Go channel for transferring ownership of 
> data is idiomatic Go. So you should consider whether a channel will work 
> and only fall back on low level primitives like sync.Cond if a channel 
> isn't suitable.
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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/d0e7edf7-0b52-4952-871e-794f42f4d804n%40googlegroups.com.

Reply via email to