1
0
mirror of https://github.com/golang/go synced 2024-11-22 14:34:45 -07:00
The Go programming language
Go to file
David Symonds dc5cffbeb7 Use the mutex in exvar.Set since map access is not atomic.
Imagine your var has a value of zero. If you have a goroutine calling Set(5),
and another calling Increment(+1), then you only want one of these outcomes:
  - Set completes first, and then Increment occurs => 6
  - Increment completes first, and then Set occurs => 5

However, you could get a sequence:
  - read (for Increment) 0
  - set (for Set) 5
  - write (for Increment) 1
This results in a value of 1, which is undesirable.

Kudos to dnadasi for catching this.

R=r
APPROVED=r
DELTA=3  (3 added, 0 deleted, 0 changed)
OCL=27625
CL=27625
2009-04-20 00:42:08 -07:00
doc spec change for redeclaration 2009-04-19 20:04:15 -07:00
include fix gotest by fixing nm -s to print in file order by storing a sequence number 2009-04-15 21:57:55 -07:00
lib help management of empty pkg and lib directories in perforce 2008-07-21 17:10:49 -07:00
pkg help management of empty pkg and lib directories in perforce 2008-07-21 17:10:49 -07:00
src Use the mutex in exvar.Set since map access is not atomic. 2009-04-20 00:42:08 -07:00
test typo in message 2009-04-19 21:12:48 -07:00
usr/gri Readn is a silly name when there's no n. Change to FullRead. 2009-04-19 21:02:29 -07:00