Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2018-06-16 21:06:30 +0000
committerDoug Schaefer2018-06-16 21:15:31 +0000
commite6550c7a10b51ae7deeb78138277b69c2d6a9ec3 (patch)
tree81e178af9b36b4b163ec1eeaaa156f7dd7539071
parent3b44424539ec13eaf9df2eab2f2b8ab9b2df8901 (diff)
downloadorg.eclipse.cdt-CDT_9_5_0.tar.gz
org.eclipse.cdt-CDT_9_5_0.tar.xz
org.eclipse.cdt-CDT_9_5_0.zip
Revert "Bug 534286. Made read(byte[],int,int) blocking"CDT_9_5_0
-rw-r--r--native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java35
1 files changed, 9 insertions, 26 deletions
diff --git a/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java b/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
index 8b49cf9e676..abbeacb5f9b 100644
--- a/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
+++ b/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
@@ -103,38 +103,21 @@ public class SerialPort {
rpos += n;
return n;
} else {
- while (isOpen()) {
- n = read1(handle, b, off, len);
- if (n <= 0 ) {
- if (isPaused) {
- synchronized (pauseMutex) {
- while (isPaused) {
- try {
- pauseMutex.wait();
- } catch (InterruptedException e) {
- return -1;
- }
- }
- }
- }
- else if (n < 0) {
- // End of stream, connection closed?
- return n;
- }
- else {
- // Nothing available yet, keep blocking
+ n = read1(handle, b, off, len);
+ if (n <= 0 && isPaused) {
+ synchronized (pauseMutex) {
+ while (isPaused) {
try {
- Thread.sleep(500);
+ pauseMutex.wait();
} catch (InterruptedException e) {
- // ignore
+ return -1;
}
}
- } else {
- return n;
}
+ return read1(handle, b, off, len);
+ } else {
+ return n;
}
-
- return -1;
}
} else {
return -1;

Back to the top