opengl: Refactoring: More similar way to golang.org/x/mobile/app

This commit is contained in:
Hajime Hoshi 2018-03-25 18:23:34 +09:00
parent c47b549fd1
commit c0b1919020

View File

@ -93,12 +93,13 @@ func (c *Context) DoWork(chError <-chan error, chDone <-chan struct{}) error {
panic("not reached") panic("not reached")
} }
// TODO: Check this is called on the rendering thread // TODO: Check this is called on the rendering thread
workAvailable := c.worker.WorkAvailable()
loop: loop:
for { for {
select { select {
case err := <-chError: case err := <-chError:
return err return err
case <-c.worker.WorkAvailable(): case <-workAvailable:
c.worker.DoWork() c.worker.DoWork()
case <-chDone: case <-chDone:
break loop break loop