mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 22:44:28 +01:00
parent
cf6edae5b3
commit
d1138bc615
@ -95,9 +95,20 @@ func (p *player) Pause() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *player) Play() {
|
func (p *player) Play() {
|
||||||
p.cond.L.Lock()
|
// Call Play asynchronously since Oboe's Play might take long.
|
||||||
defer p.cond.L.Unlock()
|
ch := make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
p.cond.L.Lock()
|
||||||
|
defer p.cond.L.Unlock()
|
||||||
|
close(ch)
|
||||||
|
p.playImpl()
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Wait until the mutex is locked in the above goroutine.
|
||||||
|
<-ch
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *player) playImpl() {
|
||||||
if p.err != nil {
|
if p.err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user