clarify avoiding API while holding configurationLock

This commit is contained in:
Jesse Hallam 2018-10-01 17:18:36 -04:00
parent 8adb629abd
commit eb2678c625
No known key found for this signature in database
GPG key ID: E7959EB6518AF966

View file

@ -43,7 +43,8 @@ func (p *Plugin) getConfiguration() *configuration {
// setConfiguration replaces the active configuration under lock.
//
// Do not call setConfiguration while holding the configurationLock, as sync.Mutex is not
// reentrant.
// reentrant. In particular, avoid using the plugin API entirely, as this may in turn trigger a
// hook back into the plugin. If that hook attempts to acquire this lock, a deadlock may occur.
func (p *Plugin) setConfiguration(configuration *configuration) {
p.configurationLock.Lock()
defer p.configurationLock.Unlock()