mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
audio: Bug fix: nosync might cause unexpected panics because of runtime.Gosched
This commit is contained in:
parent
873b3905df
commit
cf452bb709
@ -31,10 +31,10 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
"github.com/hajimehoshi/ebiten/internal/sync"
|
||||
"github.com/hajimehoshi/oto"
|
||||
)
|
||||
|
||||
@ -118,32 +118,32 @@ func (p *players) Read(b []byte) (int, error) {
|
||||
|
||||
func (p *players) addPlayer(player *Player) {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
p.players[player] = struct{}{}
|
||||
p.Unlock()
|
||||
}
|
||||
|
||||
func (p *players) removePlayer(player *Player) {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
delete(p.players, player)
|
||||
p.Unlock()
|
||||
}
|
||||
|
||||
func (p *players) addSeeking(player *Player) {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
p.seekings[player] = struct{}{}
|
||||
p.Unlock()
|
||||
}
|
||||
|
||||
func (p *players) removeSeeking(player *Player) {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
delete(p.seekings, player)
|
||||
p.Unlock()
|
||||
}
|
||||
|
||||
func (p *players) hasPlayer(player *Player) bool {
|
||||
p.RLock()
|
||||
defer p.RUnlock()
|
||||
_, ok := p.players[player]
|
||||
p.RUnlock()
|
||||
return ok
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user