mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
cf6edae5b3
commit
d1138bc615
@ -95,9 +95,20 @@ func (p *player) Pause() {
|
||||
}
|
||||
|
||||
func (p *player) Play() {
|
||||
// Call Play asynchronously since Oboe's Play might take long.
|
||||
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 {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user