FAQ
What Jan said. You probably want this: http://play.golang.org/p/UBIHU5x0Oo

- RK

On Mon, Jul 29, 2013 at 10:38 AM, Jan Mercl wrote:
On Mon, Jul 29, 2013 at 7:32 PM, Rob Thornton wrote:
Forgive my ignorance but I don't quite understand why the race detector is
saying this is a data race: http://play.golang.org/p/dlTpSSchs3

Doesn't the mutex protect against that?
From a brief peek at your code I think the race is this:

37: m.Write(i)

The value of 'i' is part of the closure and is mutated by the main
gouroutine and read concurrently, but without synchronization by
multiple goroutines.

-j

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 6 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 29, '13 at 5:32p
activeJul 30, '13 at 2:57p
posts6
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase