L4Re Operating System Framework
Interface and Usage Documentation
•All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
thread
Go to the documentation of this file.
1// vim:set ft=cpp: -*- Mode: C++ -*-
6/*
7 * (c) 2004-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
8 * economic rights: Technische Universität Dresden (Germany)
9 * This file is part of TUD:OS and distributed under the terms of the
10 * GNU Lesser General Public License 2.1.
11 * Please see the COPYING-LGPL-2.1 file for details.
12 */
13
14#ifndef CXX_THREAD_H__
15#define CXX_THREAD_H__
16
17#include <l4/sys/capability>
18#include <l4/sys/types.h>
19
20namespace cxx {
21
22 class Thread
23 {
24 public:
25
26 enum State
27 {
28 Dead = 0,
29 Running = 1,
30 Stopped = 2,
31 };
32
33 Thread(bool initiate);
34 Thread(void *stack);
35 Thread(void *stack, L4::Cap<L4::Thread> const &cap);
36 virtual ~Thread();
37 void execute() asm ("L4_Thread_execute");
38 virtual void run() = 0;
39 virtual void shutdown() asm ("L4_Thread_shutdown");
40 void start();
41 void stop();
42
43 L4::Cap<L4::Thread> self() const throw()
44 { return _cap; }
45
46 State state() const
47 { return _state; }
48
49 static void start_cxx_thread(Thread *_this)
50 asm ("L4_Thread_start_cxx_thread");
51
52 static void kill_cxx_thread(Thread *_this)
53 asm ("L4_Thread_kill_cxx_thread");
54
55 static void set_pager(L4::Cap<void>const &p) throw()
56 { _pager = p; }
57
58 private:
59 int create();
60
62 State _state;
63
64 protected:
65 void *_stack;
66
67 private:
68 static L4::Cap<void> _pager;
69 static L4::Cap<void> _master;
70 };
71
72};
73
74#endif /* CXX_THREAD_H__ */
75
L4::Cap related definitions.
C++ interface for capabilities.
Definition capability.h:219
Common L4 ABI Data Types.
L4 low-level kernel interface.
Our C++ library.
Definition arith:11