internal/ui: use RLock/RUnlock whenever possible

This commit is contained in:
Hajime Hoshi 2023-09-24 19:27:22 +09:00
parent 4fb27adb9d
commit fab08bac92

View File

@ -204,8 +204,8 @@ func (u *userInterfaceImpl) setInitMonitor(m *Monitor) {
} }
func (u *userInterfaceImpl) getInitMonitor() *Monitor { func (u *userInterfaceImpl) getInitMonitor() *Monitor {
u.m.Lock() u.m.RLock()
defer u.m.Unlock() defer u.m.RUnlock()
return u.initMonitor return u.initMonitor
} }
@ -450,10 +450,9 @@ func (u *userInterfaceImpl) getInitWindowSizeInDIP() (int, int) {
return microsoftgdk.MonitorResolution() return microsoftgdk.MonitorResolution()
} }
u.m.Lock() u.m.RLock()
w, h := u.initWindowWidthInDIP, u.initWindowHeightInDIP defer u.m.RUnlock()
u.m.Unlock() return u.initWindowWidthInDIP, u.initWindowHeightInDIP
return w, h
} }
func (u *userInterfaceImpl) setInitWindowSizeInDIP(width, height int) { func (u *userInterfaceImpl) setInitWindowSizeInDIP(width, height int) {