Grokking Concurrency in Go
Vote

0% completed

​

How Mutexes Work Inside

The documentation of sync.Mutex makes a short list of promises. At most one goroutine holds the mutex at a time. The zero value is a mutex that nobody holds. Each call to Unlock synchronizes before the next call to Lock, in the terms of The Go Memory Model. Any goroutine may call Unlock, not only the one that called Lock.

The list of things it does not promise matters as much. The order in which waiters get the mutex is not stated. The mutex is not reentrant, so a goroutine that calls Lock twice without `Unlock

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content