function naming convention in rlock/lock methods

Viewed 33

I am wondering are there any naming conventions in GoLang when calling a method that expects a variable to be rlocked or rwlocked?

example:

type XXX struct {
  mu sync.RWMutex
}

func (x XXX) rUnlockCallMethod {
    x.mu.RUnlock()
    defer x.mu.RLock()
    x.CallMethod()
}

func (x XXX) CallMethod {
  x.mu.Lock()
  defer x.mu.Unlock()
  // do something 
}

my question is does rUnlockCallMethod is the right naming convention. or is there any other convention in Go for expecting a rlocked state or a rwlocked state so others will be able to understand the expected state when using the function

thanks

0 Answers
Related