Commit Graph

16 Commits

Author SHA1 Message Date
Hajime Hoshi
c67e4385de internal/thread: bug fix: do not close 'terminate' channel
The `terminate` channel is resued on mobiles (see (*UserInterface).Update
in internal/uidriver/mobile). The channel must not be closed.

Closes #1932
2022-01-05 17:21:53 +09:00
Changkun Ou
626c91e360
ebiten: add RunOnMainThread(func()) (#1927)
Closes #1926
2022-01-03 03:30:29 +09:00
Hajime Hoshi
43c964a3b8 internal/thread: Refactoring 2021-06-15 00:43:48 +09:00
Hajime Hoshi
eedb947471 Update comments 2020-10-21 03:17:40 +09:00
Jake Coffman
290f05060a
ebiten: Add ebitensinglethread build tag (#1396)
Updates #1367
2020-10-21 02:55:17 +09:00
Hajime Hoshi
349faa0f34 thread: Use an error value instead of context.Context 2020-08-30 02:18:12 +09:00
Hajime Hoshi
9a14d2fb14 thread: Fix comments
Fixes #1121
2020-03-29 16:27:12 +09:00
Hajime Hoshi
41d07706ae Revert "thread: Close channels"
This reverts commit 00e78c1eae.

Reason: (*Thread).Loop can be called multiple times on iOS.

Fixes #1121
2020-03-29 16:25:42 +09:00
Hajime Hoshi
5040b3bcfc thread: Add comments 2020-02-24 01:54:52 +09:00
Hajime Hoshi
00e78c1eae thread: Close channels 2020-02-24 01:50:23 +09:00
corfe83
a18cddb39f
Reduce heap allocations in thread.go and input.go (#1085)
I've been doing some profiling of a very simple ebiten project, and noticed that thread.go was doing a bunch of unnecessary allocations to accomplish its work. This change seeks to reduce GC work.

Input.go was also doing some unnecessary allocations.

The thread.go change reduces the total number of allocations per frame from 1342 to 852 (~36% reduction). The input.go change reduces it further to 752 (~44% total reduction). Perf tests were done on windows.
2020-02-21 09:59:45 +09:00
Hajime Hoshi
8dc2301e54 thread: Bug fix: Queue funcs instead of panic
Now the thread object is created at (*UserInterface).Run, we don't
have to care whether the (main) thread is started or not when
Call is called. Admit queueing the functions.

Fixes #884
2019-06-21 11:10:27 +09:00
Hajime Hoshi
449679665b thread: Use standard context.Context 2019-06-08 01:46:06 +09:00
Hajime Hoshi
9c283d45b4 thread: started should be reset after Loop 2019-06-06 00:25:57 +09:00
Hajime Hoshi
85dcafe176 thread: Rename Run -> Call 2019-06-06 00:25:57 +09:00
Hajime Hoshi
15a5896efd thread: Rename mainthread -> thread and add struct Thread
This enables thread available not only for the main thread but also
any threads.

This is a preparation for iOS Metal, that runs drawing functions on
a particular thread.

Updates #737
2019-06-06 00:25:53 +09:00