mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 19:22:49 +01:00
audio/internal/readerdriver: Bug fix: Deadlock at Close (js)
This commit is contained in:
parent
2c8d3826fa
commit
7a6bdc8388
@ -272,7 +272,10 @@ func (p *player) IsPlaying() bool {
|
|||||||
func (p *player) Reset() {
|
func (p *player) Reset() {
|
||||||
p.cond.L.Lock()
|
p.cond.L.Lock()
|
||||||
defer p.cond.L.Unlock()
|
defer p.cond.L.Unlock()
|
||||||
|
p.resetImpl()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *player) resetImpl() {
|
||||||
if p.err != nil {
|
if p.err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -312,14 +315,14 @@ func (p *player) Err() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *player) Close() error {
|
func (p *player) Close() error {
|
||||||
|
runtime.SetFinalizer(p, nil)
|
||||||
p.cond.L.Lock()
|
p.cond.L.Lock()
|
||||||
defer p.cond.L.Unlock()
|
defer p.cond.L.Unlock()
|
||||||
return p.closeImpl()
|
return p.closeImpl()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *player) closeImpl() error {
|
func (p *player) closeImpl() error {
|
||||||
runtime.SetFinalizer(p, nil)
|
p.resetImpl()
|
||||||
p.Reset()
|
|
||||||
p.state = playerClosed
|
p.state = playerClosed
|
||||||
p.appendBufferFunc.Release()
|
p.appendBufferFunc.Release()
|
||||||
p.cond.Signal()
|
p.cond.Signal()
|
||||||
|
Loading…
Reference in New Issue
Block a user