Use runtime.LockOSThread at main

This commit is contained in:
Hajime Hoshi 2013-12-04 21:51:39 +09:00
parent dd979ac4d6
commit 24a735dd0b
2 changed files with 2 additions and 6 deletions

View File

@ -24,6 +24,7 @@ type Game interface {
func main() { func main() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())
runtime.LockOSThread()
gameName := "" gameName := ""
if 2 <= len(os.Args) { if 2 <= len(os.Args) {

View File

@ -19,14 +19,9 @@ import (
"github.com/hajimehoshi/go-ebiten/graphics" "github.com/hajimehoshi/go-ebiten/graphics"
"github.com/hajimehoshi/go-ebiten/graphics/opengl" "github.com/hajimehoshi/go-ebiten/graphics/opengl"
"github.com/hajimehoshi/go-ebiten/ui" "github.com/hajimehoshi/go-ebiten/ui"
"runtime"
"unsafe" "unsafe"
) )
func init() {
runtime.LockOSThread()
}
type UI struct { type UI struct {
screenWidth int screenWidth int
screenHeight int screenHeight int
@ -87,7 +82,7 @@ func (u *UI) LoadTextures(map[int]string) {
func (u *UI) LoadResources(f func(graphics.TextureFactory)) { func (u *UI) LoadResources(f func(graphics.TextureFactory)) {
C.BeginDrawing(u.window) C.BeginDrawing(u.window)
f(u.graphicsDevice.TextureFactory()) f(u.graphicsDevice)
C.EndDrawing(u.window) C.EndDrawing(u.window)
} }