OOStuBS - Technische Informatik II (TI-II)
2.4
Hauptseite
Zusätzliche Informationen
Klassen
Dateien
Auflistung der Dateien
Datei-Elemente
src
locking
interruptLock.cc
gehe zur Dokumentation dieser Datei
1
#include "
locking/interruptLock.h
"
2
3
#include "
object/log.h
"
4
#include "
object/cpu.h
"
5
6
void
InterruptLock::enter
(){
7
interruptState
=
true
;
8
state
=
true
;
9
}
10
11
void
InterruptLock::leave
(){
12
state
=
false
;
13
}
14
15
void
InterruptLock::lock
(){
16
interruptState
=
cpu
.
disable_int
();
17
if
(
state
)
18
log
<<
"Lock("
<<
this
<<
"): double lock"
<<
endl
;
19
state
=
true
;
20
}
21
22
void
InterruptLock::unlock
(){
23
if
(!
state
)
24
log
<<
"Lock("
<<
this
<<
"): double unlock"
<<
endl
;
25
state
=
false
;
26
if
(
interruptState
)
27
cpu
.
enable_int
();
28
}
29
30
InterruptLock::~InterruptLock
(){
31
if
(
state
)
32
unlock
();
33
}
Erzeugt am Mon Jun 30 2014 07:13:28 für OOStuBS - Technische Informatik II (TI-II) von
1.8.1.2