Categorygithub.com/codemodify/systemkit-debug-sync
repositorypackage
1.9.3
Repository: https://github.com/codemodify/systemkit-debug-sync.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Debug Sync Objects

What

Drop-in replacement for sync.* types with deadlock detection

Normal Use

import "github.com/codemodify/systemkit-debug-sync"
var mutex syncdebug.Mutex

mutex.Lock()
defer mutex.Unlock()

Dead-Lock Scenario 1

go func(){
	...
	mutex1.Lock()
	mutex2.Lock()
	...
}()

go func(){
	...
	mutex2.Lock() // lock order reversed, DEAD-LOCK
	mutex1.Lock()
	...
}()

Dead-Lock Scenario 2

go func(){
	...
	mutex1.Lock()
	mutex2.Lock()
	...

	...
	mutex1.Lock() // lock order reversed, DEAD-LOCK
	mutex2.Lock()
	...
}()