summaryrefslogtreecommitdiff
path: root/libgo/go/sync/cond.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/sync/cond.go')
-rw-r--r--libgo/go/sync/cond.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/libgo/go/sync/cond.go b/libgo/go/sync/cond.go
index 1fc3deaf1e0..491b9856919 100644
--- a/libgo/go/sync/cond.go
+++ b/libgo/go/sync/cond.go
@@ -56,6 +56,9 @@ func NewCond(l Locker) *Cond {
// c.L.Unlock()
//
func (c *Cond) Wait() {
+ if raceenabled {
+ raceDisable()
+ }
c.m.Lock()
if c.newSema == nil {
c.newSema = new(uint32)
@@ -63,6 +66,9 @@ func (c *Cond) Wait() {
s := c.newSema
c.newWaiters++
c.m.Unlock()
+ if raceenabled {
+ raceEnable()
+ }
c.L.Unlock()
runtime_Semacquire(s)
c.L.Lock()
@@ -73,6 +79,9 @@ func (c *Cond) Wait() {
// It is allowed but not required for the caller to hold c.L
// during the call.
func (c *Cond) Signal() {
+ if raceenabled {
+ raceDisable()
+ }
c.m.Lock()
if c.oldWaiters == 0 && c.newWaiters > 0 {
// Retire old generation; rename new to old.
@@ -86,6 +95,9 @@ func (c *Cond) Signal() {
runtime_Semrelease(c.oldSema)
}
c.m.Unlock()
+ if raceenabled {
+ raceEnable()
+ }
}
// Broadcast wakes all goroutines waiting on c.
@@ -93,6 +105,9 @@ func (c *Cond) Signal() {
// It is allowed but not required for the caller to hold c.L
// during the call.
func (c *Cond) Broadcast() {
+ if raceenabled {
+ raceDisable()
+ }
c.m.Lock()
// Wake both generations.
if c.oldWaiters > 0 {
@@ -109,4 +124,7 @@ func (c *Cond) Broadcast() {
c.newSema = nil
}
c.m.Unlock()
+ if raceenabled {
+ raceEnable()
+ }
}