There are two cases in mutex.TryLock <https://github.com/golang/go/blob/master/src/sync/mutex.go#L98> could return false
- the lock is currently held by another goroutine. - the lock is not held but the mutex is in starvation mode; i.e., the lock will be handed off to the next waiter. However, Per The Go memory model <https://go.dev/ref/mem> > As far as the memory model is concerned, l.TryLock (or l.TryRLock) may be considered to be able to return false even when the mutex l is unlocked. I am confused about the above sentence. How to understand the mutex.TryLock returns false even when the mutex is unlocked based on the memory model in Go? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/60ee11a0-31ee-48e1-ad94-aaeb01630f5fn%40googlegroups.com.