Browse Source

fifo: Protect setting my_terminate_is_required

We need to keep the mutex around setting it, to make sure that the
visibility of setting it to true doesn't get delayed, notably not after
the signal (which could entail that the signal becomes useless, leading
to a hang).
master
Samuel Thibault 3 years ago
parent
commit
15091d82be
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      src/libespeak-ng/fifo.c

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

@@ -438,7 +438,9 @@ static void init(int process_parameters)

void fifo_terminate()
{
pthread_mutex_lock(&my_mutex);
my_terminate_is_required = true;
pthread_mutex_unlock(&my_mutex);
pthread_cond_signal(&my_cond_start_is_required);
pthread_join(my_thread, NULL);
my_terminate_is_required = false;

Loading…
Cancel
Save