indexing description: "[ Singleton representing the thread subsytem. Use EM_SHARED_SUBSYSTEMS to access this class. ]" date: "$Date$" revision: "$Revision$" class EM_THREAD_SUBSYSTEM inherit EM_SUBSYSTEM EM_CONSTANTS export {NONE} all end SDL_FUNCTIONS_EXTERNAL export {NONE} all end create {EM_SHARED_SUBSYSTEMS} make feature {NONE} -- Initialization make is do ensure not_enabled: not is_enabled end feature -- Status report is_enabled: BOOLEAN is -- Is the thread subsystem enabled? do Result := 0 /= sdl_was_init_external (Em_init_thread) end feature -- Subsystem management enable is -- Enable EiffelMedia thread subsystem. local i: INTEGER do i := sdl_init_external (Em_init_thread) if i >= 0 then -- TODO end end disable is -- Disable EiffelMedia thread subsystem. do -- TODO sdl_quit_sub_system_external (Em_init_thread) ensure then disabled: not is_enabled end feature -- lowlevel callback dispatcher dispatcher: INT_VOIDP_ANONYMOUS_CALLBACK_DISPATCHER is once create Result.make (receiver) end receiver: EM_THREAD_CALLBACK is -- on_callback is called whenever a new thread is created! once create Result.make end feature -- needed: a working mutex to lock the whole thread subsystem! thread_creation : EM_SEMAPHORE is -- semaphore to lock the whole thread_system. i think we need this, because we only have one callback singleton ... -- (i could be wrong though ;) once --io.put_string("thread_creation%N") create Result.make(1) end io_system : EM_MUTEX is -- mutex to lock the whole thread_system once -- io.put_string("io_system%N") create Result.make end end