Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b7cb792 authored by Charles Chen's avatar Charles Chen
Browse files

Setting the synth busy flag inside a synchronized block for

thread safety.
parent 53bd2522
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -824,11 +824,15 @@ public class TtsService extends Service implements OnCompletionListener {
                try {
                    synthAvailable = synthesizerLock.tryLock();
                    if (!synthAvailable) {
                        synchronized (this) {
                            mSynthBusy = true;
                        }
                        Thread.sleep(100);
                        Thread synth = (new Thread(new SynthThread()));
                        synth.start();
                        synchronized (this) {
                            mSynthBusy = false;
                        }
                        return;
                    }
                    String language = "";