Browse Source

Do not try to re-lock an already-locked mutex.

master
Christopher Brannon 8 years ago
parent
commit
0177e1d686
1 changed files with 2 additions and 3 deletions
  1. 2
    3
      src/libespeak-ng/fifo.c

+ 2
- 3
src/libespeak-ng/fifo.c View File

// for filtering underflow. // for filtering underflow.
// //
int i = 0; int i = 0;
int err = pthread_mutex_lock(&my_mutex);
assert(err != -1);
while ((i <= MAX_INACTIVITY_CHECK) && !a_start_is_required) { while ((i <= MAX_INACTIVITY_CHECK) && !a_start_is_required) {
i++; i++;


int err = 0;
struct timespec ts; struct timespec ts;
struct timeval tv; struct timeval tv;


clock_gettime2(&ts); clock_gettime2(&ts);


add_time_in_ms(&ts, INACTIVITY_TIMEOUT); add_time_in_ms(&ts, INACTIVITY_TIMEOUT);
err = pthread_mutex_lock(&my_mutex);
assert(err != -1);


while ((err = pthread_cond_timedwait(&my_cond_start_is_required, &my_mutex, &ts)) == -1 while ((err = pthread_cond_timedwait(&my_cond_start_is_required, &my_mutex, &ts)) == -1
&& errno == EINTR) && errno == EINTR)

Loading…
Cancel
Save