/[classpath]/classpath/java/awt/MediaTracker.java
ViewVC logotype

Diff of /classpath/java/awt/MediaTracker.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by mkoch, Mon Sep 27 15:11:46 2004 UTC revision 1.10 by rabbit78, Fri Apr 8 18:25:47 2005 UTC
# Line 76  public class MediaTracker implements jav Line 76  public class MediaTracker implements jav
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)
# Line 86  public class MediaTracker implements jav Line 86  public class MediaTracker implements jav
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    
# Line 141  public class MediaTracker implements jav Line 139  public class MediaTracker implements jav
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                {                {
# Line 204  public class MediaTracker implements jav Line 202  public class MediaTracker implements jav
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)
# Line 244  public class MediaTracker implements jav Line 246  public class MediaTracker implements jav
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                {                {
# Line 309  public class MediaTracker implements jav Line 311  public class MediaTracker implements jav
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)

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26