Project

General

Profile

« Previous | Next » 

Revision ddcfc2c2

Added by Leszek Koltunski about 8 years ago

Some more tweaking to the 'Save thread.'

View differences:

src/main/java/org/distorted/examples/save/SaveWorkerThread.java
83 83

  
84 84
    while(true)
85 85
      {
86
      if( mBuffers.size()>0 )
87
        {
88
        load = mBuffers.remove(0);
89
        process(load);
90
        }
91

  
92 86
      synchronized(mThis)
93 87
        {
88
        while( mBuffers.size()>0 )
89
          {
90
          load = mBuffers.remove(0);
91
          process(load);
92
          }
93

  
94 94
        try  { mThis.wait(); }
95 95
        catch(InterruptedException ex) { }
96 96
        }
......
101 101

  
102 102
  static void newBuffer(ByteBuffer buffer, int width, int height, String filename)
103 103
    {
104
    WorkLoad load = new WorkLoad(buffer,width,height,filename);
105
    mBuffers.add(load);
106

  
107 104
    synchronized(mThis)
108 105
      {
106
      WorkLoad load = new WorkLoad(buffer,width,height,filename);
107
      mBuffers.add(load);
109 108
      mThis.notify();
110 109
      }
111 110
    }

Also available in: Unified diff