mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-23 16:14:17 +02:00
put back the select code
This needed to be put back to keep espeakup from using 100% of the cpu.
This commit is contained in:
parent
5005b9ddde
commit
564db7981e
1 changed files with 18 additions and 0 deletions
18
softsynth.c
18
softsynth.c
|
|
@ -136,12 +136,30 @@ void close_softsynth(void)
|
|||
|
||||
void main_loop (struct synth_t *s)
|
||||
{
|
||||
fd_set set;
|
||||
struct timeval tv;
|
||||
int i;
|
||||
ssize_t length;
|
||||
char buf[maxBufferSize];
|
||||
|
||||
while (1) {
|
||||
queue_process_entry(s);
|
||||
|
||||
FD_ZERO (&set);
|
||||
FD_SET (softFD, &set);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 500;
|
||||
i = select (softFD+1, &set, NULL, NULL, &tv);
|
||||
if (i < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
perror("Select failed");
|
||||
break;
|
||||
}
|
||||
|
||||
if (! FD_ISSET(softFD, &set))
|
||||
continue;
|
||||
|
||||
length = read (softFD, buf, maxBufferSize - 1);
|
||||
if (length < 0) {
|
||||
if (errno == EAGAIN || errno == EINTR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue