Commit Graph
44 Commits
Author SHA1 Message Date
Samuel Thibault 15091d82be 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).
2022-03-16 00:22:58 +01:00
freddii 61efed30fa fixed spelling mistakes 2021-01-13 01:55:34 +01:00
Samuel Thibault e13b602ce0 Avoid using pthread_cancel
If a thread is cancelled while it holds a mutex, other threads waiting for
the mutex will never be woken, even if destroying the mutex, thus
leading to a deadlock.

Better just make the thread loops have a proper exit case than risking
the tricky semantic of pthread_cancel.
2018-11-13 01:55:17 +01:00
Juho Hiltunen 4f56345fb5 Use stdbool instead of int (Issue #8)
See issue #8, https://github.com/espeak-ng/espeak-ng/issues/8

There might still be some ints that could be changed to boolean.

Possible regressions in fifo.c:
int fifo_is_busy() and int fifo_is_command_enabled() used to return an int. Now they return a boolean. This might cause problems on systems where stdbool true/false is something else than 1/0.
2017-12-09 17:34:05 +02:00
Reece H. Dunn 6d168ead22 fifo.c: Fix -Wmissing-prototypes warnings. 2017-10-06 07:09:41 +01:00
Reece H. Dunn efd1df3206 Build a test version of libespeak-ng that exposes the internal APIs. 2017-05-09 07:37:56 +01:00
Reece H. Dunn 71c010b712 Remove unused wchar.h and wctype.h includes. 2017-02-10 08:03:40 +00:00
Reece H. Dunn dee3799f82 issue #172: flush audio on cancel requests.
This is a partial fix for an audio regression. The other part of
the fix requires a change in pcaudiolib to reopen the audio device
on flush requests for affected audio drivers/devices.
2017-01-24 07:24:29 +00:00
Reece H. Dunn dae9cda060 Revert "issue 172: fix sluggish speech for stopped speech."
This reverts commit f9ab812e00.
2017-01-12 07:14:02 +00:00
Reece H. Dunn f9ab812e00 issue 172: fix sluggish speech for stopped speech.
This restores the behaviour removed in commit
ca831d236a.

When using eSpeak for audio and eSpeak in a server, using the async
speech requests, that code stopped the audio as soon as possible
from a cancel request. This allows servers like brltty to be more
responsive.
2016-12-24 09:00:55 +00:00
Reece H. Dunn 52abe35300 Revert "Stop audio output before fifo_stop is called"
This reverts commit 1b5ea47ea4.

This patch is causing lockups when using this with servers like brltty.
2016-12-21 16:00:51 +00:00
Rui Batista b7a42e19a7 Remove commented code. 2016-12-11 18:54:12 +00:00
Rui Batista 1b5ea47ea4 Stop audio output before fifo_stop is called
This allows process_espeak_command to stop as soon as possible

Using emacspeak server with espeak-ng (still not published) found that audio was only being stoped after a command is processed (i.e. using pcaudiolib).
This fixes this issue.
2016-12-11 18:17:08 +00:00
Christopher Brannon 1d8cec684b Fix a tricky thread synchronization bug.
If a command ran to completion before the thread calling
fifo_add_command woke up, that thread would wait forever
for the command to start, never realizing that it had already
finished.
2016-10-10 21:02:15 -07:00
Christopher Brannon ad436e1172 Clear my_stop_is_acknowledged before waiting on it. 2016-10-10 18:16:34 -07:00
Christopher Brannon 2e9ec8e06a Fix race condition. 2016-10-10 18:05:06 -07:00
Christopher Brannon 0177e1d686 Do not try to re-lock an already-locked mutex. 2016-10-10 18:04:16 -07:00
Reece H. Dunn 2893de65ac Ensure that the code is consistently formatted. 2016-10-09 17:39:01 +01:00
Rui Batista 34f315363b Fix hang when waiting for condition variables. 2016-10-09 15:58:08 +01:00
Rui Batista 1bbba9bc3b Use condition variables instead of semaphores in fifo. 2016-10-09 14:51:08 +01:00
Reece H. Dunn bb465a45d8 Move the clock_gettime2 and add_time_in_ms definitions to event.h. 2016-02-07 18:38:13 +00:00
Reece H. Dunn ca831d236a Don't call wave_close in fifo.c.
This is handled by calls to espeak_ng_Cancel/espeak_Cancel and
espeak_ng_Terminate/espeak_Terminate.
2016-02-07 18:25:30 +00:00
Reece H. Dunn be93c8b3e7 Remove calls to wave_is_busy.
Removing these calls do not impact on the behaviour of the program
and simplify the wave.h API.
2016-02-07 18:11:27 +00:00
Reece H. Dunn a6f6a337b1 Add a missing pthread_mutex_unlock call in fifo_add_commands. [Coverity] 2016-01-20 22:55:20 +00:00
Reece H. Dunn 7d900fb8b0 Remove includes from internal header files. 2016-01-16 18:05:17 +00:00
Reece H. Dunn 96c43f3eb2 Clean up the include files to make them consistent. 2016-01-16 17:54:39 +00:00
Reece H. Dunn 9c5820f72a Create an initial compatibility shim for unistd.h. 2016-01-15 07:22:46 +00:00
Reece H. Dunn 39cd145ba3 Make close_stream(fifo.c) return a status code (don't assert on failure) [clang scan-build] 2016-01-06 20:12:24 +00:00
Reece H. Dunn 72db232ec3 Move include/espeak{-ng => }/speak_lib.h. 2016-01-04 19:45:23 +00:00
Reece H. Dunn 76d8c67b52 Fix the mutex logic in fifo.c from the espeak_ng_STATUS changes. 2016-01-02 19:29:17 +00:00
Reece H. Dunn dfdc76e1d8 Use espeak_ng_STATUS codes for the fifo API. 2016-01-02 13:27:35 +00:00
Reece H. Dunn b11d540718 Fix GCC -Wunused-parameter warnings. 2015-12-30 15:01:31 +00:00
Reece H. Dunn e69c936329 Remove the debugging code.
The debugging code is done inconsistently, mainly to trace the
event and audio output logic. This makes it harder to understand
the code flow for logic that is not enabled by default.

As such the debugging code makes the code harder to maintain.
2015-12-28 12:33:14 +00:00
Reece H. Dunn 3e99752d0c Check and fix source code formatting. 2015-12-27 22:34:53 +00:00
Reece H. Dunn f0c2c4cca2 Remove extra newlines from the files to provide consistent spacing. 2015-12-23 11:32:03 +00:00
Reece H. Dunn d345d74f64 Remove braces around single-line if/while/for/etc. and related cleanup. 2015-12-22 20:40:10 +00:00
Reece H. Dunn 9a837c8182 Remove parentheses around return statements. 2015-12-22 16:24:01 +00:00
Reece H. Dunn 12e0bb122b Reformat the code using the uncrustify program. 2015-12-22 15:06:50 +00:00
Reece H. Dunn 66c2831bed Use intptr_t from stdint.h instead of a custom long64 typedef. 2015-12-18 21:41:28 +00:00
Reece H. Dunn c71b24a9a5 Use a consistent license notice in the source files. 2015-12-18 07:06:29 +00:00
Reece H. Dunn cbe8695fcb Remove the * box around the file headers. 2015-12-17 23:45:36 +00:00
Reece H. Dunn 36be9ac13f Use the default uncrustify config (with indentation changes) to reformat the code. 2015-12-17 07:40:24 +00:00
Reece H. Dunn 08821f262f Remove commented out code. 2015-12-14 23:13:56 +00:00
Reece H. Dunn f7dfc38dd7 Use the C compiler to build C files; restructuring.
This moves the libespeak source (*.cpp) files to src/libespeak-ng
and renames the C files (libespeak, espeak, speak) so they have
a .c file extension.
2015-12-09 23:33:00 +00:00