state mutex

This commit is contained in:
Mark McGranaghan 2012-10-01 07:58:21 -07:00
parent 39c27a6763
commit ebec3473f2
68 changed files with 6 additions and 7 deletions

View File

@ -83,10 +83,8 @@ func main() {
go generateWrites(writes)
}
time.Sleep(10 * time.Second)
atomic.StoreInt64(&opCount, 0)
time.Sleep(time.Second)
finalOpCount := atomic.LoadInt64(&opCount)
fmt.Println(finalOpCount)
}
// todo: complement chapter with mutex

View File

@ -1,4 +1,4 @@
// ## State Goroutine (Comparison)
// ## State Mutex
package main
@ -59,8 +59,8 @@ func main() {
go generateWrites()
}
time.Sleep(10 * time.Second)
atomic.StoreInt64(&opCount, 0)
time.Sleep(time.Second)
finalOpCount := atomic.LoadInt64(&opCount)
fmt.Println(finalOpCount)
}

View File

@ -48,6 +48,7 @@ closing-channels
timers
tickers
state-goroutine
state-mutex
## core libraries
sorting