OOStuBS - Technische Informatik II (TI-II)
2.4
Hauptseite
Zusätzliche Informationen
Klassen
Dateien
Auflistung der Dateien
Datei-Elemente
src
thread
thread.cc
gehe zur Dokumentation dieser Datei
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2
* Technische Informatik II *
3
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4
* *
5
* T H R E A D *
6
* *
7
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8
9
/* * * * * * * * * * * * * * * * * * * * * * * * *\
10
# INCLUDES #
11
\* * * * * * * * * * * * * * * * * * * * * * * * */
12
13
#include "
thread/thread.h
"
14
#include "
object/lock.h
"
15
#include "
object/scheduler.h
"
16
#include "
object/log.h
"
17
18
/* * * * * * * * * * * * * * * * * * * * * * * * *\
19
# METHODS #
20
\* * * * * * * * * * * * * * * * * * * * * * * * */
21
22
void
Thread::kickoff
(
Thread
* thread){
23
log
<<
"Thread "
<< thread <<
" starts execution"
<<
endl
;
24
lock
.
unlock
();
25
thread->
action
();
26
while
(
true
)
27
thread->
exit
();
28
}
29
30
Thread::Thread
() : context(this){}
31
32
Thread::~Thread
(){
33
exit
();
34
}
35
36
void
Thread::yield
(){
37
scheduler
.
yield
();
38
}
39
40
void
Thread::exit
(){
41
scheduler
.
exit
();
42
}
Erzeugt am Mon Jun 30 2014 07:13:28 für OOStuBS - Technische Informatik II (TI-II) von
1.8.1.2