mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Revert "Bug 534286. Made read(byte[],int,int) blocking"
This reverts commit e5c7bb64f7
.
Change-Id: I565f9eb2728d0ff0199e61f3f25df4aa0b64f17b
This commit is contained in:
parent
3b44424539
commit
e6550c7a10
1 changed files with 9 additions and 26 deletions
|
@ -103,10 +103,8 @@ public class SerialPort {
|
||||||
rpos += n;
|
rpos += n;
|
||||||
return n;
|
return n;
|
||||||
} else {
|
} else {
|
||||||
while (isOpen()) {
|
|
||||||
n = read1(handle, b, off, len);
|
n = read1(handle, b, off, len);
|
||||||
if (n <= 0 ) {
|
if (n <= 0 && isPaused) {
|
||||||
if (isPaused) {
|
|
||||||
synchronized (pauseMutex) {
|
synchronized (pauseMutex) {
|
||||||
while (isPaused) {
|
while (isPaused) {
|
||||||
try {
|
try {
|
||||||
|
@ -116,26 +114,11 @@ public class SerialPort {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return read1(handle, b, off, len);
|
||||||
else if (n < 0) {
|
|
||||||
// End of stream, connection closed?
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Nothing available yet, keep blocking
|
|
||||||
try {
|
|
||||||
Thread.sleep(500);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue