Changeset 2019


Ignore:
Timestamp:
01/04/07 14:45:02 (13 years ago)
Author:
curtis
Message:

Fix bug where background slice loading thread took 100% CPU.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/browser/CacheManager.java

    r2017 r2019  
    269269    this.oldStrategy = strategy; 
    270270 
    271     //set default axes' priorities 
     271    // set default axes' priorities 
    272272    curTPriority = 2; 
    273273    curZPriority = 1; 
     
    277277    oldCPriority = 0; 
    278278    queue = new Stack(); 
    279     loader = new Thread(this,"Browser-Loader"); 
     279    loader = new Thread(this, "Browser-Loader"); 
    280280    loader.setPriority(Thread.MIN_PRIORITY); 
    281281    loader.start(); 
    282282 
    283     //Start the caching thread. 
     283    // start the caching thread 
    284284    updateCache(); 
    285285  } 
     
    20362036  // -- Runnable API methods -- 
    20372037 
    2038   /** The thread method that does the slice loading.*/ 
     2038  /** Loads the slices. */ 
    20392039  public void run() { 
    2040     quit = false; 
    2041  
    2042     while(!quit) { 
    2043       if(!queue.empty()) { 
     2040    while(!quit && db != null) { 
     2041      if (queue.empty()) { 
     2042        try { 
     2043          Thread.sleep(50); 
     2044        } 
     2045        catch (InterruptedException exc) { exc.printStackTrace(); } 
     2046      } 
     2047      else { 
    20442048        int index = ((Integer)queue.pop()).intValue(); 
    20452049        if(DEBUG) System.out.println("Loading index " + index); 
     
    20572061        } 
    20582062      } 
    2059       if(db == null) quit = true; 
    2060     } 
    2061   } 
    2062  
     2063    } 
     2064  } 
     2065 
     2066  /** Terminates the slice loading thread. */ 
    20632067  public void finish() { 
    20642068    quit = true; 
Note: See TracChangeset for help on using the changeset viewer.