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
wrote:
>
> if the intent is to "print" the producer's output before the consumer's,
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
It's just want I want to do, Thank you very much.
El vie., 25 ene. 2019 a las 12:27, Wagner Riffel ()
escribió:
> 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
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 wrote:
> Hi all, i'am just learning Go and goroutines, I have three goroutines
> (main, producer,
It works correctly. What you see is the race between the printf calls at
each iteration
On Thu, Jan 24, 2019 at 2:40 PM diego patricio wrote:
> Hi, I just want to achieve that one goroutine send a data and another
> goroutine receive it and print it consequently, for instance o, 1, 2, 3.
>
> Is
Hi, I just want to achieve that one goroutine send a data and another
goroutine receive it and print it consequently, for instance o, 1, 2, 3.
Is there a correct way to achieve this ?
Regards
El jue., 24 ene. 2019 a las 23:08, Ian Denhardt ()
escribió:
> In general, after the message send goes
In general, after the message send goes through, the two goroutines
involved could start executing again in any order -- so the behavior
you're seeing is expected?
Is there a less toy example that this is supposed to be representative
of? Or were you just expecting it to work differently, and
Hi, thanks for your response, still I dont get right result
[image: image.png]
[image: image.png]
El jue., 24 ene. 2019 a las 22:42, Christian Staffa (<
christian.p.sta...@gmail.com>) escribió:
> Hi
>
> to get a synchronization with goroutines you need to use an unbuffered
> channel. you have
Hi
to get a synchronization with goroutines you need to use an unbuffered channel.
you have used a buffered channel of 1.
Sent from my iPhone
> On 24. Jan 2019, at 22:11, diego patricio wrote:
>
> Hi all, i'am just learning Go and goroutines, I have three goroutines (main,
> producer,
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
10 matches
Mail list logo