Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.thread

Class EM_THREAD


Direct ancestors

EM_SHARED_SUBSYSTEMS, SDL_THREAD_FUNCTIONS_EXTERNAL, SDL_FUNCTIONS

Known direct descendants

EM_FUNCTION_THREAD, EM_PROCEDURE_THREAD

Features

Invariants

indexing

description

*** Since Eiffel doesn't correctly support threats, this doesn't work yet ***

Use this class to start a function in another thread.
The function must not have any open arguments and it has to return
an integer value.

If someone has a great idea how to implement open arguments: feel free :)
We would have to create a C pointer to an arbitrary count of arguments
(ie a TUPLE) that would be passed to the start feature.

date

$Date: 2005/10/26 17:25:41 $

revision

$Revision: 1.12 $

deferred class

EM_THREAD

inherit

EM_SHARED_SUBSYSTEMS

feature -- Access

audio_subsystem: EM_AUDIO_SUBSYSTEM

-- EiffelMedia audio subsystem

-- (From EM_SHARED_SUBSYSTEMS)

ensure
audio_subsystem_not_void: Result /= Void
cdrom_subsystem: EM_CDROM_SUBSYSTEM

-- EiffelMedia CD ROM subsystem

-- (From EM_SHARED_SUBSYSTEMS)

ensure
cdrom_subsystem_not_void: Result /= Void
joystick_subsystem: EM_JOYSTICK_SUBSYSTEM

-- EiffelMedia joystick subsystem

-- (From EM_SHARED_SUBSYSTEMS)

ensure
joystick_subsystem_not_void: Result /= Void
network_subsystem: EM_NETWORK_SUBSYSTEM

-- EiffelMedia network subsystem is

-- (From EM_SHARED_SUBSYSTEMS)

ensure
network_subsystem_not_void: Result /= void
timer_subsystem: EM_TIMER_SUBSYSTEM

-- EiffelMedia timer subsystem

-- (From EM_SHARED_SUBSYSTEMS)

ensure
timer_subsystem_not_void: Result /= Void
video_subsystem: EM_VIDEO_SUBSYSTEM

-- EiffelMedia video subsystem

-- (From EM_SHARED_SUBSYSTEMS)

ensure
video_subsystem_not_void: Result /= Void

feature -- Control

kill

-- Aborts the thread gracelessly.
-- You should avoid using this.

require
running: is_running
ensure
not_running: not is_running
start

-- Starts the thread.

require
not_running: not is_running
wait

-- Wait for a thread to finish (no timeouts are supported -> worst case: wait forever, deadlock)
-- This should only be called by an other thread than this one

require
running: is_running

feature -- Run

run: INTEGER

-- this will be executed

feature -- Status information

id: INTEGER

-- Returns the ID of this thread.

require
thread_running: is_running
is_finished: BOOLEAN

-- Return True if the thread has finished its execution.

is_running: BOOLEAN

-- Returns True if the thread is running.

return_code: INTEGER

-- The return code of the function that was executed.
-- This will be -1 if is_finished is False.

invariant


-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end