76 |
int width, int height) |
int width, int height) |
77 |
{ |
{ |
78 |
if ((flags & ABORT) != 0) |
if ((flags & ABORT) != 0) |
79 |
status = ABORTED | COMPLETE; |
status = ABORTED; |
80 |
else if ((flags & ERROR) != 0) |
else if ((flags & ERROR) != 0) |
81 |
status = ERRORED | COMPLETE; |
status = ERRORED; |
82 |
else if ((flags & ALLBITS) != 0) |
else if ((flags & ALLBITS) != 0) |
83 |
status = COMPLETE; |
status = COMPLETE; |
84 |
else if ((flags & SOMEBITS) != 0) |
else if ((flags & SOMEBITS) != 0) |
86 |
else |
else |
87 |
status = 0; |
status = 0; |
88 |
|
|
89 |
if ((status & COMPLETE) == COMPLETE) |
synchronized (MediaTracker.this) |
90 |
{ |
{ |
|
synchronized (MediaTracker.this) |
|
|
{ |
|
91 |
MediaTracker.this.notifyAll(); |
MediaTracker.this.notifyAll(); |
92 |
} |
} |
93 |
} |
|
94 |
// If status is not COMPLETE then we need more updates. |
// If status is not COMPLETE then we need more updates. |
95 |
return (status & COMPLETE) == 0; |
return ((status & (COMPLETE | ERRORED | ABORTED)) == 0); |
96 |
} |
} |
97 |
} |
} |
98 |
|
|
139 |
|
|
140 |
while (e != null) |
while (e != null) |
141 |
{ |
{ |
142 |
if ((e.status & COMPLETE) == 0) |
if ((e.status & (COMPLETE | ERRORED | ABORTED)) == 0) |
143 |
{ |
{ |
144 |
if (load) |
if (load) |
145 |
{ |
{ |
202 |
public boolean waitForAll(long ms) throws InterruptedException |
public boolean waitForAll(long ms) throws InterruptedException |
203 |
{ |
{ |
204 |
long start = System.currentTimeMillis(); |
long start = System.currentTimeMillis(); |
205 |
|
boolean result = checkAll(true); |
206 |
synchronized (this) |
synchronized (this) |
207 |
{ |
{ |
208 |
while (!checkAll(true)) |
while (result == false) |
209 |
wait(ms); |
{ |
210 |
|
wait(ms); |
211 |
|
result = checkAll(true); |
212 |
|
if ((System.currentTimeMillis() - start) < ms) |
213 |
|
break; |
214 |
|
} |
215 |
} |
} |
216 |
if ((System.currentTimeMillis() - start) < ms) |
|
217 |
return true; |
return result; |
|
else |
|
|
return false; |
|
218 |
} |
} |
219 |
|
|
220 |
public int statusAll(boolean load) |
public int statusAll(boolean load) |
246 |
|
|
247 |
while (e != null) |
while (e != null) |
248 |
{ |
{ |
249 |
if (e.id == id && ((e.status & COMPLETE) == 0)) |
if (e.id == id && ((e.status & (COMPLETE | ABORTED | ERRORED)) == 0)) |
250 |
{ |
{ |
251 |
if (load) |
if (load) |
252 |
{ |
{ |
311 |
{ |
{ |
312 |
MediaEntry e = head; |
MediaEntry e = head; |
313 |
long start = System.currentTimeMillis(); |
long start = System.currentTimeMillis(); |
314 |
|
boolean result = checkID(id, true); |
315 |
|
|
316 |
synchronized (this) |
synchronized (this) |
317 |
{ |
{ |
318 |
while (checkID (id, true) == false) |
while (result == false) |
319 |
wait(ms); |
{ |
320 |
} |
wait(ms); |
321 |
if ((System.currentTimeMillis() - start) < ms) |
result = checkID(id, true); |
322 |
return true; |
if ((System.currentTimeMillis() - start) < ms) |
323 |
else |
break; |
324 |
return false; |
} |
325 |
|
} |
326 |
|
|
327 |
|
return result; |
328 |
} |
} |
329 |
|
|
330 |
public int statusID(int id, boolean load) |
public int statusID(int id, boolean load) |