Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
speakup
thread.c
Go to the documentation of this file.
1
#include <
linux/kthread.h
>
2
#include <linux/wait.h>
3
4
#include "
spk_types.h
"
5
#include "
speakup.h
"
6
#include "
spk_priv.h
"
7
8
DECLARE_WAIT_QUEUE_HEAD
(speakup_event);
9
EXPORT_SYMBOL_GPL
(speakup_event);
10
11
int
speakup_thread
(
void
*
data
)
12
{
13
unsigned
long
flags
;
14
int
should_break;
15
struct
bleep
our_sound;
16
17
our_sound.
active
= 0;
18
our_sound.
freq
= 0;
19
our_sound.
jiffies
= 0;
20
21
mutex_lock
(&
spk_mutex
);
22
while
(1) {
23
DEFINE_WAIT
(
wait
);
24
while
(1) {
25
spk_lock
(flags);
26
our_sound =
unprocessed_sound
;
27
unprocessed_sound
.active = 0;
28
prepare_to_wait
(&
speakup_event
, &
wait
,
29
TASK_INTERRUPTIBLE
);
30
should_break =
kthread_should_stop
() ||
31
our_sound.
active
||
32
(
synth
&&
synth
->catch_up &&
synth
->alive &&
33
(
speakup_info
.flushing ||
34
!
synth_buffer_empty
()));
35
spk_unlock
(flags);
36
if
(should_break)
37
break
;
38
mutex_unlock
(&
spk_mutex
);
39
schedule
();
40
mutex_lock
(&
spk_mutex
);
41
}
42
finish_wait
(&
speakup_event
, &
wait
);
43
if
(
kthread_should_stop
())
44
break
;
45
46
if
(our_sound.
active
)
47
kd_mksound
(our_sound.
freq
, our_sound.
jiffies
);
48
if
(
synth
&&
synth
->catch_up &&
synth
->alive) {
49
/* It is up to the callee to take the lock, so that it
50
* can sleep whenever it likes */
51
synth
->catch_up(
synth
);
52
}
53
54
speakup_start_ttys
();
55
}
56
mutex_unlock
(&
spk_mutex
);
57
return
0;
58
}
Generated on Thu Jan 10 2013 14:31:46 for Linux Kernel by
1.8.2