sorry, i can't see how the order could matter here, in any case if it's a problem just send on wait before fmt.Printf. https://play.golang.org/p/iDsszgEHpQo
BR. On Fri, Jan 25, 2019 at 2:32 PM Skip Tavakkolian <skip.tavakkol...@gmail.com> wrote: > > if the intent is to "print" the producer's output before the consumer's, then > this example still can't guarantee it; for example: > https://play.golang.org/p/2sb67Qf5IPd > > the only synchronization guarantee is the moment of exchange on the channel. > > On Fri, Jan 25, 2019 at 3:27 AM Wagner Riffel <wgrrif...@gmail.com> wrote: >> >> 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: >>> >>> >>> The output: >>> >>> >>> 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. -- 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.