71 |
public void run() { |
public void run() { |
72 |
try { |
try { |
73 |
while(true) { |
while(true) { |
74 |
|
Runnable r; |
75 |
synchronized(queue) { |
synchronized(queue) { |
76 |
Runnable r = (Runnable)queue.getAndRemoveLowest(); |
r = (Runnable)queue.getAndRemoveLowest(); |
77 |
if(r == null) { |
if(r == null) { |
78 |
queue.wait(); |
queue.wait(); |
79 |
continue; |
continue; |
80 |
} |
} |
|
if(dbg) pa("BG: Going to run "+r); |
|
|
r.run(); |
|
|
if(dbg) pa("BG: Did run "+r); |
|
81 |
} |
} |
82 |
|
if(dbg) pa("BG: Going to run "+r); |
83 |
|
r.run(); |
84 |
|
if(dbg) pa("BG: Did run "+r); |
85 |
} |
} |
86 |
} catch(InterruptedException e) { |
} catch(InterruptedException e) { |
87 |
pa("BG INTERRUPTED"); |
pa("BG INTERRUPTED"); |