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

return status; return status;


if (a_event_is_running) { 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; return ENS_OK;
int a_status = pthread_mutex_lock(&my_mutex); int a_status = pthread_mutex_lock(&my_mutex);
my_event_is_running = 0; 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; my_event_is_running = 1;
a_stop_is_required = 0; a_stop_is_required = 0;


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

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


a_status = pthread_mutex_lock(&my_mutex); a_status = pthread_mutex_lock(&my_mutex);
event_delete((espeak_EVENT *)pop()); event_delete((espeak_EVENT *)pop());
a_stop_is_required = my_stop_is_required; 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; my_stop_is_required = 0;


a_status = pthread_mutex_unlock(&my_mutex); a_status = pthread_mutex_unlock(&my_mutex);

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



// leave once the thread is actually started // leave once the thread is actually started
assert(-1 != pthread_mutex_lock(&my_mutex)); 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; my_stop_is_acknowledged = 0;
pthread_mutex_unlock(&my_mutex); pthread_mutex_unlock(&my_mutex);
} }
} }


if (a_command_is_running) { 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 continue; // Restart when interrupted by handler
}
} }


my_stop_is_required = 0; my_stop_is_required = 0;
assert(!a_status); assert(!a_status);


if (!a_start_is_required) { 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