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

Comparing jsr166/src/main/java/util/concurrent/SynchronousQueue.java (file contents):
Revision 1.13 by tim, Wed Aug 6 18:22:09 2003 UTC vs.
Revision 1.14 by tim, Fri Aug 8 20:05:07 2003 UTC

# Line 100 | Line 100 | public class SynchronousQueue<E> extends
100                      if (done != null)
101                          done.signal();
102                      return true;
103 <                }
104 <                else // taker has cancelled
103 >                } else // taker has cancelled
104                      return false;
105 <            }
107 <            finally {
105 >            } finally {
106                  this.unlock();
107              }
108          }
# Line 123 | Line 121 | public class SynchronousQueue<E> extends
121                      if (done != null)
122                          done.signal();
123                      return x;
124 <                }
127 <                else
124 >                } else
125                      return null;
126 <            }
130 <            finally {
126 >            } finally {
127                  this.unlock();
128              }
129          }
# Line 154 | Line 150 | public class SynchronousQueue<E> extends
150                      else
151                          done.await();
152                  }
153 <            }
158 <            catch (InterruptedException ie) {
153 >            } catch (InterruptedException ie) {
154                  // If taken, return normally but set interrupt status
155                  if (item == null) {
156                      Thread.currentThread().interrupt();
157                      return true;
158 <                }
164 <                else {
158 >                } else {
159                      item = CANCELLED;
160                      done.signal(); // propagate signal
161                      throw ie;
162                  }
163 <            }
170 <            finally {
163 >            } finally {
164                  this.unlock();
165              }
166          }
# Line 198 | Line 191 | public class SynchronousQueue<E> extends
191                      else
192                          done.await();
193                  }
194 <            }
202 <            catch (InterruptedException ie) {
194 >            } catch (InterruptedException ie) {
195                  Object y = item;
196                  if (y != null) {
197                      item = null;
198                      next = null;
199                      Thread.currentThread().interrupt();
200                      return y;
201 <                }
210 <                else {
201 >                } else {
202                      item = CANCELLED;
203                      done.signal(); // propagate signal
204                      throw ie;
205                  }
206 <            }
216 <            finally {
206 >            } finally {
207                  this.unlock();
208              }
209          }
# Line 257 | Line 247 | public class SynchronousQueue<E> extends
247                  node = waitingTakes.deq();
248                  if ( (mustWait = (node == null)) )
249                      node = waitingPuts.enq(x);
250 <            }
261 <            finally {
250 >            } finally {
251                  qlock.unlock();
252              }
253  
# Line 285 | Line 274 | public class SynchronousQueue<E> extends
274                  node = waitingPuts.deq();
275                  if ( (mustWait = (node == null)) )
276                      node = waitingTakes.enq(null);
277 <            }
289 <            finally {
277 >            } finally {
278                  qlock.unlock();
279              }
280  
# Line 363 | Line 351 | public class SynchronousQueue<E> extends
351              Node node;
352              try {
353                  node = waitingTakes.deq();
354 <            }
367 <            finally {
354 >            } finally {
355                  qlock.unlock();
356              }
357              if (node == null)
# Line 383 | Line 370 | public class SynchronousQueue<E> extends
370              qlock.lock();
371              try {
372                  node = waitingPuts.deq();
373 <            }
387 <            finally {
373 >            } finally {
374                  qlock.unlock();
375              }
376              if (node == null)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines