mirror of
https://github.com/JetSetIlly/Gopher2600.git
synced 2024-05-20 13:48:02 -04:00
TV nudge counter access is now an atomic operation
This commit is contained in:
parent
3d610ccdcc
commit
45ae4b6be3
|
@ -74,7 +74,7 @@ type limiter struct {
|
|||
matchRefreshRateDelay int
|
||||
|
||||
// nudge the limiter so that it doesn't wait for the specified number of frames
|
||||
nudge int
|
||||
nudge atomic.Int32
|
||||
}
|
||||
|
||||
func (lmtr *limiter) init(tv *Television) {
|
||||
|
@ -131,8 +131,9 @@ func (lmtr *limiter) setRate(fps float32) {
|
|||
func (lmtr *limiter) checkFrame() {
|
||||
lmtr.measureCt++
|
||||
|
||||
if lmtr.nudge > 0 {
|
||||
lmtr.nudge--
|
||||
nudge := lmtr.nudge.Load()
|
||||
if nudge > 0 {
|
||||
lmtr.nudge.Store(nudge - 1)
|
||||
} else {
|
||||
if lmtr.active {
|
||||
lmtr.pulseCt++
|
||||
|
|
|
@ -841,7 +841,7 @@ func (tv *Television) NudgeFPSCap(frames int) {
|
|||
if frames < 0 {
|
||||
frames = 0
|
||||
}
|
||||
tv.lmtr.nudge = frames
|
||||
tv.lmtr.nudge.Store(int32(frames))
|
||||
}
|
||||
|
||||
// SetFPSCap whether the emulation should wait for FPS limiter. Returns the
|
||||
|
|
Loading…
Reference in a new issue