I have a bunch of functions in a Go program that work on a struct that uses a mutex to manage concurrent access to its functions.
Some of these functions, that operate on specific data, need locks and thereby use mutex.Lock() to get hold of a mutex that manages the access to that data. Today I encountered an issue when two of these locking methods call each other. As soon as mutex.Lock() is called a second time it blocks - of course.
The problem I am facing is very similar to this code: http://play.golang.org/p/rPARZsordI
Is there any best-practise in Go on how to solve this issue? As far as I know recursive locks are not available in Go.