4 ms·
The problem with that is that the methods for `sync.RWMutex` spill into `Backend`.
by mutatio 7y ago
The problem with that is that the methods for `sync.RWMutex` spill into `Backend`.
- thegeekpirate 7y agoThat isn't a problem—in fact, that's the entire point of arberavdullahu's suggestion.
- fiveturns 7y agoStill seems like a problem to me. It breaks encapsulation. The mutex is only used inside of SetAlive() and isAlive(), they're the only things this need to handle locking and unlocking. You don't want anything external to that calling the methods on RWMutex.
- thegeekpirate 7y agoOh of course, if you're not using it then don't expose it. I haven't read the code so I can't verify if that's the case here, but I read OPs post as being worried about method clobbering (which is really a non-issue, if the popularity of embedding mutexes shows us anything).