maybe it's the way you approached the problem, here is a perhaps cleaner
way to achieve desired output, https://play.golang.org/p/3a4lxbjdQAr

BR.

On Thu, Jan 24, 2019 at 7:12 PM diego patricio <dipas...@gmail.com> wrote:

> Hi all, i'am just learning Go and goroutines, I have three goroutines
> (main, producer, consumer) and I dont know how synchronize producer and
> consumer for print one value at time, the output that I want is
>
> Producer 0
> Consumer 0
> Producer 1
> Consumer 1
> ......
> but the output of my program it's diferent.
>
> the program:
>
> [image: image.png]
>
> The output:
>
> [image: image.png]
>
> Sorry about my english
>
> Regards
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to