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

Comparing jsr166/src/main/java/util/concurrent/Semaphore.java (file contents):
Revision 1.7 by dl, Fri Jul 11 13:12:06 2003 UTC vs.
Revision 1.8 by tim, Fri Aug 8 20:05:07 2003 UTC

# Line 54 | Line 54 | import java.util.concurrent.locks.*;
54   *          if (used[i]) {
55   *            used[i] = false;
56   *            return true;
57 < *          }
58 < *          else
57 > *          } else
58   *            return false;
59   *       }
60   *     }
# Line 166 | Line 165 | public class Semaphore implements java.i
165              while (count <= 0)
166                  available.await();
167              --count;
168 <        }
170 <        catch (InterruptedException ie) {
168 >        } catch (InterruptedException ie) {
169              available.signal();
170              throw ie;
171 <        }
174 <        finally {
171 >        } finally {
172              lock.unlock();
173          }
174      }
# Line 202 | Line 199 | public class Semaphore implements java.i
199              while (count <= 0)
200                  available.awaitUninterruptibly();
201              --count;
202 <        }
206 <        finally {
202 >        } finally {
203              lock.unlock();
204          }
205      }
# Line 229 | Line 225 | public class Semaphore implements java.i
225                  return true;
226              }
227              return false;
228 <        }
233 <        finally {
228 >        } finally {
229              lock.unlock();
230          }
231      }
# Line 291 | Line 286 | public class Semaphore implements java.i
286                      return false;
287                  nanos = available.awaitNanos(nanos);
288              }
289 <        }
295 <        catch (InterruptedException ie) {
289 >        } catch (InterruptedException ie) {
290              available.signal();
291              throw ie;
292 <        }
299 <        finally {
292 >        } finally {
293              lock.unlock();
294          }
295      }
# Line 318 | Line 311 | public class Semaphore implements java.i
311          try {
312              ++count;
313              available.signal();
314 <        }
322 <        finally {
314 >        } finally {
315              lock.unlock();
316          }
317      }
# Line 334 | Line 326 | public class Semaphore implements java.i
326          lock.lock();
327          try {
328              return count;
329 <        }
338 <        finally {
329 >        } finally {
330              lock.unlock();
331          }
332      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines