Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ebiten: add RunOnMainThread(func()) #1927

Merged
merged 5 commits into from
Jan 2, 2022
Merged

Conversation

changkun
Copy link
Contributor

@changkun changkun commented Jan 2, 2022

Fixes #1926

@hajimehoshi
Copy link
Owner

Please make runOnMainThread not to return error first. Probably we will have to fix internal/thread. Thanks,

@changkun
Copy link
Contributor Author

changkun commented Jan 2, 2022

Please make runOnMainThread not to return error first. Probably we will have to fix internal/thread. Thanks,

Done.

@hajimehoshi
Copy link
Owner

panic: close of closed channel

goroutine 1 [running, locked to thread]:
github.com/hajimehoshi/ebiten/v2/internal/thread.(*OSThread).Loop(0xc0000248e0)
	/home/runner/work/ebiten/ebiten/internal/thread/thread.go:56 +0xfa
github.com/hajimehoshi/ebiten/v2/internal/uidriver/glfw.(*UserInterface).Run(0x94bf60, 0x7a8d00, 0x9c6840, 0x80, 0xc0004c1e78)
	/home/runner/work/ebiten/ebiten/internal/uidriver/glfw/run_notsinglethread.go:54 +0x1ab
github.com/hajimehoshi/ebiten/v2.RunGame(0x7a6880, 0xc0000248d0, 0x0, 0x0)
	/home/runner/work/ebiten/ebiten/run.go:164 +0xef
github.com/hajimehoshi/ebiten/v2/internal/testing.MainWithRunLoop(0xc000380180)
	/home/runner/work/ebiten/ebiten/internal/testing/testing.go:49 +0x68
github.com/hajimehoshi/ebiten/v2_test.TestMain(...)
	/home/runner/work/ebiten/ebiten/image_test.go:57
main.main()
	_testmain.go:275 +0x16c
FAIL	github.com/hajimehoshi/ebiten/v2	2.223s

Apparently the test fails...

@changkun
Copy link
Contributor Author

changkun commented Jan 2, 2022

Apparently the test fails...

Oppos... The panic should be resolved in the latest commit

run.go Outdated Show resolved Hide resolved
Copy link
Owner

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@hajimehoshi hajimehoshi merged commit 626c91e into hajimehoshi:main Jan 2, 2022
@changkun changkun deleted the issue1926 branch January 2, 2022 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proposal: provide public RunOnMainThread API
2 participants