ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/CyclicBarrier.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/CyclicBarrier.java (file contents):
Revision 1.8 by dl, Tue Aug 5 23:59:16 2003 UTC vs.
Revision 1.9 by tim, Fri Aug 8 20:05:07 2003 UTC

# Line 38 | Line 38 | import java.util.concurrent.locks.*;
38   *
39   *         try {
40   *           barrier.await();
41 + *         } catch (InterruptedException ex) {
42 + *           return;
43 + *         } catch (BrokenBarrierException ex) {
44 + *           return;
45   *         }
42 *         catch (InterruptedException ex) { return; }
43 *         catch (BrokenBarrierException ex) { return; }
46   *       }
47   *     }
48   *   }
# Line 160 | Line 162 | public class CyclicBarrier {
162                      if (barrierCommand != null)
163                          barrierCommand.run();
164                      return 0;
165 <                }
164 <                catch (RuntimeException ex) {
165 >                } catch (RuntimeException ex) {
166                      broken = generation; // next generation is broken
167                      throw ex;
168                  }
# Line 173 | Line 174 | public class CyclicBarrier {
174                          trip.await();
175                      else if (nanos > 0)
176                          nanos = trip.awaitNanos(nanos);
177 <                }
177 <                catch (InterruptedException ex) {
177 >                } catch (InterruptedException ex) {
178                      // Only claim that broken if interrupted before reset
179                      if (generation == g) {
180                          broken = g;
181                          trip.signalAll();
182                          throw ex;
183 <                    }
184 <                    else {
183 >                    } else {
184                          Thread.currentThread().interrupt(); // propagate
185                          break;
186                      }
# Line 199 | Line 198 | public class CyclicBarrier {
198              }
199              return index;
200  
201 <        }
203 <        finally {
201 >        } finally {
202              lock.unlock();
203          }
204      }
# Line 300 | Line 298 | public class CyclicBarrier {
298      public int await() throws InterruptedException, BrokenBarrierException {
299          try {
300              return dowait(false, 0);
301 <        }
304 <        catch (TimeoutException toe) {
301 >        } catch (TimeoutException toe) {
302              throw new Error(toe); // cannot happen;
303          }
304      }
# Line 374 | Line 371 | public class CyclicBarrier {
371          lock.lock();
372          try {
373              return broken >= generation;
374 <        }
378 <        finally {
374 >        } finally {
375              lock.unlock();
376          }
377      }
# Line 396 | Line 392 | public class CyclicBarrier {
392              nextGeneration();
393              broken = g; // cause brokenness setting to stop at previous gen.
394              trip.signalAll();
395 <        }
400 <        finally {
395 >        } finally {
396              lock.unlock();
397          }
398      }
# Line 412 | Line 407 | public class CyclicBarrier {
407          lock.lock();
408          try {
409              return parties - count;
410 <        }
416 <        finally {
410 >        } finally {
411              lock.unlock();
412          }
413      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines