mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 04:55:22 +02:00
[fix] Synchronize waitAndDispatch implementations
This commit is contained in:
parent
782dfcd8ea
commit
50ded2aa5f
1 changed files with 2 additions and 2 deletions
|
@ -108,12 +108,12 @@ public final class RSEWaitAndDispatchUtil {
|
||||||
boolean isTimedOut= false;
|
boolean isTimedOut= false;
|
||||||
if (timeout >= 0 && condition != null) {
|
if (timeout >= 0 && condition != null) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Display display = Display.findDisplay(Thread.currentThread());
|
final Display display = Display.findDisplay(Thread.currentThread());
|
||||||
if (display != null) {
|
if (display != null) {
|
||||||
// ok, we are running within a display thread --> keep the
|
// ok, we are running within a display thread --> keep the
|
||||||
// display event dispatching running.
|
// display event dispatching running.
|
||||||
long current = System.currentTimeMillis();
|
long current = System.currentTimeMillis();
|
||||||
while (timeout == 0 || (current - start) < timeout) {
|
while (timeout == 0 || (current - start) < timeout && !display.isDisposed()) {
|
||||||
if (condition.isTrue()) break;
|
if (condition.isTrue()) break;
|
||||||
if (!display.readAndDispatch()) display.sleep();
|
if (!display.readAndDispatch()) display.sleep();
|
||||||
current = System.currentTimeMillis();
|
current = System.currentTimeMillis();
|
||||||
|
|
Loading…
Add table
Reference in a new issue