Description

Worker is used by display driver code to execute OpenGL calls.

Typically display driver code creates a gl.Context for an application, and along with it establishes a locked OS thread to execute the cgo calls:

go func() {
	runtime.LockOSThread()
	// ... platform-specific cgo call to bind a C OpenGL context
	// into thread-local storage.

	glctx, worker := gl.NewContext()
	workAvailable := worker.WorkAvailable()
	go userAppCode(glctx)
	for {
		select {
		case <-workAvailable:
			worker.DoWork()
		case <-drawEvent:
			// ... platform-specific cgo call to draw screen
		}
	}
}()

This interface is an internal implementation detail and should only be used by the package responsible for managing the screen, such as golang.org/x/mobile/app.

Worker is referenced in 6 repositories

github.com/golang/mobile github.com/golang/exp go.googlesource.com/mobile

...