You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the following code:
func ExampleCond_single() {
var m Mutex
c := MakeCond(&m)
percent := 0
const step = 10
for i := 0; i < 5; i++ {
go func() { // ######## LINE 134
for {
// Emulates some useful work.
time.Sleep(1e8)
m.Lock()
defer // ######## The problem is actually here
if percent == 100 {
m.Unlock()
break
}
percent++
if percent % step == 0 {
c.Signal()
}
m.Unlock()
}
}()
}
for {
m.Lock()
if percent == 0 || percent % step != 0 {
c.Wait()
}
fmt.Print(",")
if percent == 100 {
m.Unlock()
break
}
m.Unlock()
}
}
gc says only:
cond_test.go:134:6: expected function/method call (and 14 more errors)
This usually means then I miss "()" after "go func() {}", but it is
not the case here. It confuses. The problem is actually with stand-alone defer.
12079:45a0ca092e9d tip
The text was updated successfully, but these errors were encountered:
What command were you running?
That's not gc talking, or the :6: would
not be there. It's some program using
go/parser and not expanding the error list.
The part about defer is surely one of the
14 more errors.
The text was updated successfully, but these errors were encountered: