Browse Source

Ensure that the code is consistently formatted.

master
Reece H. Dunn 8 years ago
parent
commit
2893de65ac
2 changed files with 20 additions and 16 deletions
  1. 9
    8
      src/libespeak-ng/event.c
  2. 11
    8
      src/libespeak-ng/fifo.c

+ 9
- 8
src/libespeak-ng/event.c View File

@@ -241,9 +241,10 @@ espeak_ng_STATUS event_clear_all()
return status;

if (a_event_is_running) {
while(my_stop_is_acknowledged == 0)
while((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR)
continue; // Restart when interrupted by handler
while (my_stop_is_acknowledged == 0) {
while ((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR)
continue; // Restart when interrupted by handler
}
}

return ENS_OK;
@@ -259,9 +260,10 @@ static void *polling_thread(void *p)
int a_status = pthread_mutex_lock(&my_mutex);
my_event_is_running = 0;

while(my_start_is_required == 0)
while((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR)
continue; // Restart when interrupted by handler
while (my_start_is_required == 0) {
while ((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR)
continue; // Restart when interrupted by handler
}

my_event_is_running = 1;
a_stop_is_required = 0;
@@ -271,7 +273,6 @@ static void *polling_thread(void *p)

// In this loop, my_event_is_running = 1
while (head && (a_stop_is_required == 0)) {

espeak_EVENT *event = (espeak_EVENT *)(head->data);
assert(event);

@@ -286,7 +287,7 @@ static void *polling_thread(void *p)
a_status = pthread_mutex_lock(&my_mutex);
event_delete((espeak_EVENT *)pop());
a_stop_is_required = my_stop_is_required;
if(a_stop_is_required > 0)
if (a_stop_is_required > 0)
my_stop_is_required = 0;

a_status = pthread_mutex_unlock(&my_mutex);

+ 11
- 8
src/libespeak-ng/fifo.c View File

@@ -91,9 +91,10 @@ void fifo_init()

// leave once the thread is actually started
assert(-1 != pthread_mutex_lock(&my_mutex));
while (my_stop_is_acknowledged == 0)
while((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR)
;
while (my_stop_is_acknowledged == 0) {
while ((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR)
;
}
my_stop_is_acknowledged = 0;
pthread_mutex_unlock(&my_mutex);
}
@@ -173,9 +174,10 @@ espeak_ng_STATUS fifo_stop()
}

if (a_command_is_running) {
while (my_stop_is_acknowledged == 0)
while((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR)
while (my_stop_is_acknowledged == 0) {
while ((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR)
continue; // Restart when interrupted by handler
}
}

my_stop_is_required = 0;
@@ -295,9 +297,10 @@ static void *say_thread(void *p)
assert(!a_status);

if (!a_start_is_required) {
while (my_start_is_required == 0)
while((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR)
continue; // Restart when interrupted by handler
while (my_start_is_required == 0) {
while ((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR)
continue; // Restart when interrupted by handler
}
}



Loading…
Cancel
Save