lib/sync: Fix a race in unlocker logging (fixes #3884)

Other routines use atomics, hence even if we are under a lock, we should
too.

We might atomically store with
Not sure how it happens, but it's between lines

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3974
This commit is contained in:
Audrius Butkevicius 2017-02-08 22:31:19 +00:00 committed by Jakob Borg
parent 72de47df00
commit 120e6eab2c
1 changed files with 1 additions and 1 deletions

View File

@ -123,7 +123,7 @@ func (m *loggedRWMutex) Lock() {
atomic.StoreInt32(&m.logUnlockers, 1)
m.RWMutex.Lock()
m.logUnlockers = 0
atomic.StoreInt32(&m.logUnlockers, 0)
holder := getHolder()
m.holder.Store(holder)