mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
3d385ef0aa
commit
38d6328e41
@ -37,12 +37,6 @@ func (u *UserInterface) runMultiThread(game Game, options *RunOptions) error {
|
||||
u.mainThread = thread.NewOSThread()
|
||||
graphicscommand.SetOSThreadAsRenderThread()
|
||||
|
||||
// Set the running state true after the main thread is set, and before initOnMainThread is called (#2742).
|
||||
// TODO: As the existence of the main thread is the same as the value of `running`, this is redundant.
|
||||
// Make `mainThread` atomic and remove `running` if possible.
|
||||
u.setRunning(true)
|
||||
defer u.setRunning(false)
|
||||
|
||||
u.context = newContext(game)
|
||||
|
||||
ctx, cancel := stdcontext.WithCancel(stdcontext.Background())
|
||||
@ -61,6 +55,12 @@ func (u *UserInterface) runMultiThread(game Game, options *RunOptions) error {
|
||||
wg.Go(func() error {
|
||||
defer cancel()
|
||||
|
||||
// Set the running state true after the main thread is set, and before initOnMainThread is called (#2742).
|
||||
// TODO: As the existence of the main thread is the same as the value of `running`, this is redundant.
|
||||
// Make `mainThread` atomic and remove `running` if possible.
|
||||
u.setRunning(true)
|
||||
defer u.setRunning(false)
|
||||
|
||||
var err error
|
||||
u.mainThread.Call(func() {
|
||||
if err1 := u.initOnMainThread(options); err1 != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user