aboutsummaryrefslogtreecommitdiff
path: root/src/lib/sync
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-05-22 22:43:57 -0700
committerRuss Cox <rsc@golang.org>2009-05-22 22:43:57 -0700
commitca2fe5d8bd77b1a159baddde66f8f6ca5e731be2 (patch)
treeb6132390c4156a7249f1ec0bb7a3b13d7f27e6b1 /src/lib/sync
parent2a4dcfffc9d0618dd63b04db50816d82e4db5dc7 (diff)
downloadgo-ca2fe5d8bd77b1a159baddde66f8f6ca5e731be2.tar.xz
Automated g4 rollback of changelist 29302.
*** Reason for rollback *** too many files included *** Original change description *** simplifying grammar: delete LBASETYPE and LACONST R=ken OCL=29303 CL=29303
Diffstat (limited to 'src/lib/sync')
-rw-r--r--src/lib/sync/mutex.go22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/lib/sync/mutex.go b/src/lib/sync/mutex.go
index e485867802..5a6311a837 100644
--- a/src/lib/sync/mutex.go
+++ b/src/lib/sync/mutex.go
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-/*
- The sync /* package * / provides basic sync primitives.
- // Such as mutual exclusion locks.
-*/
+// The sync package provides basic synchronization primitives
+// such as mutual exclusion locks. These are intended for use
+// by low-level library routines. Higher-level synchronization
+// is better done via channels and communication.
package sync
func cas(val *int32, old, new int32) bool
func semacquire(*int32)
func semrelease(*int32)
- // A Mutex is a mutual exclusion lock.
- // Mutexes can be created as part of other structures;
- // the zero value for a Mutex is an unlocked mutex.
+// A Mutex is a mutual exclusion lock.
+// Mutexes can be created as part of other structures;
+// the zero value for a Mutex is an unlocked mutex.
type Mutex struct {
key int32;
sema int32;
@@ -30,11 +30,9 @@ func xadd(val *int32, delta int32) (new int32) {
panic("unreached")
}
-/*
- * Lock locks m.
- * If the lock is already in use, the calling goroutine
- * blocks until the mutex is available.
- */
+// Lock locks m.
+// If the lock is already in use, the calling goroutine
+// blocks until the mutex is available.
func (m *Mutex) Lock() {
if xadd(&m.key, 1) == 1 {
// changed from 0 to 1; we hold lock