From 8f19fb094712dd6a871136c8522e0cf87fb3025e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 20 Oct 2015 03:26:40 +0200 Subject: Implement sdl:which_subsystems/0 --- src/sdl.erl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/sdl.erl') diff --git a/src/sdl.erl b/src/sdl.erl index 5fd965f..5391d32 100644 --- a/src/sdl.erl +++ b/src/sdl.erl @@ -21,6 +21,7 @@ -export([start_subsystems/1]). -export([stop_subsystems/1]). -export([is_started/1]). +-export([which_subsystems/0]). -type error() :: {error, string()}. -export_type([error/0]). @@ -64,4 +65,9 @@ stop_subsystems(Subsystems) -> -spec is_started(subsystem()) -> boolean(). is_started(Subsystem) -> esdl2:was_init([Subsystem]), + receive {'_nif_thread_ret_', Ret} -> Ret =:= [Subsystem] end. + +-spec which_subsystems() -> [subsystem()]. +which_subsystems() -> + esdl2:was_init([]), receive {'_nif_thread_ret_', Ret} -> Ret end. -- cgit v1.2.3