summaryrefslogtreecommitdiff
path: root/src/pkg/sync/mutex.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-12-15 15:40:16 -0800
committerRobert Griesemer <gri@golang.org>2009-12-15 15:40:16 -0800
commit13ac778ef2f757c7cd636b4336a2bd6c8f403b43 (patch)
tree28b6ebc4aa762e38c45f4b0b69d3aee472ed4c3c /src/pkg/sync/mutex.go
parente4bd81f903362d998f7bfc02095935408aff0bc5 (diff)
downloadgolang-13ac778ef2f757c7cd636b4336a2bd6c8f403b43.tar.gz
1) Change default gofmt default settings for
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 4th set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180049
Diffstat (limited to 'src/pkg/sync/mutex.go')
-rw-r--r--src/pkg/sync/mutex.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkg/sync/mutex.go b/src/pkg/sync/mutex.go
index 9ba628824..b170370bc 100644
--- a/src/pkg/sync/mutex.go
+++ b/src/pkg/sync/mutex.go
@@ -16,8 +16,8 @@ func cas(val *uint32, old, new uint32) bool
// Mutexes can be created as part of other structures;
// the zero value for a Mutex is an unlocked mutex.
type Mutex struct {
- key uint32;
- sema uint32;
+ key uint32
+ sema uint32
}
// Add delta to *val, and return the new *val in a thread-safe way. If multiple
@@ -25,13 +25,13 @@ type Mutex struct {
// serialized, and all the deltas will be added in an undefined order.
func xadd(val *uint32, delta int32) (new uint32) {
for {
- v := *val;
- nv := v + uint32(delta);
+ v := *val
+ nv := v + uint32(delta)
if cas(val, v, nv) {
return nv
}
}
- panic("unreached");
+ panic("unreached")
}
// Lock locks m.
@@ -42,7 +42,7 @@ func (m *Mutex) Lock() {
// changed from 0 to 1; we hold lock
return
}
- runtime.Semacquire(&m.sema);
+ runtime.Semacquire(&m.sema)
}
// Unlock unlocks m.
@@ -56,5 +56,5 @@ func (m *Mutex) Unlock() {
// changed from 1 to 0; no contention
return
}
- runtime.Semrelease(&m.sema);
+ runtime.Semrelease(&m.sema)
}