2 * (c) 2008-2009 Technische Universität Dresden
3 * This file is part of TUD:OS and distributed under the terms of the
4 * GNU General Public License 2.
5 * Please see the COPYING-GPL-2 file for details.
12 #include <l4/sys/scheduler>
13 #include <l4/re/util/object_registry>
14 #include <l4/re/util/cap_alloc>
16 #include <l4/cxx/ipc_server>
19 class App_task : public Ned::Server_object
25 enum State { Initializing, Running, Zombie };
27 long remove_ref() { return --_ref_cnt; }
28 void add_ref() { ++_ref_cnt; }
30 long ref_cnt() const { return _ref_cnt; }
33 // hm, missing template typedefs
34 template< typename T >
35 struct Auto_del_cap : public L4Re::Util::Auto_del_cap<T> {};
37 // hm, missing template typedefs
38 template< typename T >
39 struct Auto_cap : public L4Re::Util::Auto_cap<T> {};
43 Auto_del_cap<L4::Task>::Cap _task;
44 Auto_del_cap<L4::Thread>::Cap _thread;
45 Auto_del_cap<L4Re::Rm>::Cap _rm;
48 unsigned long _exit_code;
49 l4_cap_idx_t _observer;
52 State state() const { return _state; }
53 unsigned long exit_code() const { return _exit_code; }
54 l4_cap_idx_t observer() const { return _observer; }
55 void observer(l4_cap_idx_t o) { _observer = o; }
59 add_ref(); // so we run do not silently kick this task
63 App_task(Ned::Registry *r, L4::Cap<L4::Factory> alloc);
65 //L4::Cap<L4Re::Mem_alloc> allocator() const { return _ma; }
67 int dispatch(l4_umword_t obj, L4::Ipc_iostream &ios);
69 L4::Cap<L4Re::Rm> rm() { return _rm.get(); }
70 L4::Cap<L4::Task> task_cap() const { return _task.get(); }
71 L4::Cap<L4::Thread> thread_cap() const { return _thread.get(); }
73 virtual void terminate();