diff options
author | Nathan Mulcahey <[email protected]> | 2017-07-17 15:59:39 -0700 |
---|---|---|
committer | Nathan Mulcahey <[email protected]> | 2017-07-17 15:59:39 -0700 |
commit | 5581ea67ca8831b74450d7ad3d5be68be2a013b3 (patch) | |
tree | 32195d9002a962d1d652c02c35087db78ba51862 | |
parent | 4d158c44e93849622aa56633fbe1f1facbe1eea9 (diff) |
Ensure upper bound for argument to Thread#setPriority is less than
Thread#MAX_PRIORITY
-rw-r--r-- | src/com/jsyn/engine/SynthesisEngine.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/jsyn/engine/SynthesisEngine.java b/src/com/jsyn/engine/SynthesisEngine.java index c79083e..b49e78e 100644 --- a/src/com/jsyn/engine/SynthesisEngine.java +++ b/src/com/jsyn/engine/SynthesisEngine.java @@ -233,7 +233,9 @@ public class SynthesisEngine implements Synthesizer { engineThread = new EngineThread(inputDeviceID, numInputChannels, outputDeviceID, numOutputChannels); logger.fine("Synth thread old priority = " + engineThread.getPriority()); - engineThread.setPriority(engineThread.getPriority() + 2); + int engineThreadPriority = engineThread.getPriority() + 2 > Thread.MAX_PRIORITY ? + Thread.MAX_PRIORITY : engineThread.getPriority() + 2; + engineThread.setPriority(engineThreadPriority); logger.fine("Synth thread new priority = " + engineThread.getPriority()); engineThread.start(); } |