aboutsummaryrefslogtreecommitdiffstats
path: root/src/sdl.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-04-08 10:59:57 +0200
committerLoïc Hoguin <[email protected]>2014-04-08 11:01:03 +0200
commit424cf7c72829a39f10f1d5e6975118e4348c0379 (patch)
tree2a6aae87f9daf2a856e87bd0a85c772ced32f48a /src/sdl.erl
parentf5ecbb3b0282637423b236b2532d3e312cb8b291 (diff)
downloadesdl2-424cf7c72829a39f10f1d5e6975118e4348c0379.tar.gz
esdl2-424cf7c72829a39f10f1d5e6975118e4348c0379.tar.bz2
esdl2-424cf7c72829a39f10f1d5e6975118e4348c0379.zip
Make the sdl module C code use the main thread
All video operations should be on the main thread, including initialization. This makes no difference on my system, but might on others. There is no cost doing this as these functions are very rarely called, and usually before/after everything else.
Diffstat (limited to 'src/sdl.erl')
-rw-r--r--src/sdl.erl11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sdl.erl b/src/sdl.erl
index b7adae6..1b8c6a6 100644
--- a/src/sdl.erl
+++ b/src/sdl.erl
@@ -23,10 +23,11 @@
-export([is_started/1]).
start() ->
- esdl2:init([]).
+ start([]).
start(Subsystems) ->
- esdl2:init(Subsystems).
+ esdl2:init(Subsystems),
+ receive {'_nif_thread_ret_', Ret} -> Ret end.
stop() ->
esdl2:quit().
@@ -42,10 +43,12 @@ stop_on_exit() ->
ok.
start_subsystems(Subsystems) ->
- esdl2:init_subsystem(Subsystems).
+ esdl2:init_subsystem(Subsystems),
+ receive {'_nif_thread_ret_', Ret} -> Ret end.
stop_subsystems(Subsystems) ->
esdl2:quit_subsystem(Subsystems).
is_started(Subsystem) ->
- esdl2:was_init([Subsystem]).
+ esdl2:was_init([Subsystem]),
+ receive {'_nif_thread_ret_', Ret} -> Ret end.