4 * Copyright 2006,2007 Martin Quinson, Malek Cherier
\r
5 * All right reserved.
\r
7 * This program is free software; you can redistribute
\r
8 * it and/or modify it under the terms of the license
\r
9 *(GNU LGPL) which comes with this package.
\r
11 package simgrid.msg;
\r
14 private int permits_;
\r
20 public void acquire() throws InterruptedException {
\r
22 if (Thread.interrupted())
\r
23 throw new InterruptedException();
\r
25 synchronized(this) {
\r
28 while (permits_ <= 0)
\r
33 catch (InterruptedException ex) {
\r
40 public synchronized void release() {
\r