Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
various cleanups to the java bindings
[simgrid.git] / src / java / simgrid / msg / Sem.java
index 0394d57..af1d60b 100644 (file)
@@ -1,49 +1,35 @@
 /*\r
- * simgrid.msg.Sem.java        1.00 07/05/01\r
+ * Simple semaphore implementation, from Doug Lea (public domain)\r
  *\r
- * Copyright 2006,2007 Martin Quinson, Malek Cherier           \r
+ * Copyright 2006,2007,2010 The SimGrid Team           \r
  * All right reserved. \r
  *\r
  * This program is free software; you can redistribute \r
  * it and/or modify it under the terms of the license \r
  *(GNU LGPL) which comes with this package. \r
- */\r
\r
-package simgrid.msg;\r
-\r
-public class Sem { \r
-       \r
-       /******************************************************************/\r
-       /* Simple semaphore implementation, from Doug Lea (public domain) */\r
-       /******************************************************************/\r
-       private int permits_;\r
-       \r
-       public Sem(int i) {\r
-               permits_ = i;\r
-       }\r
-       \r
-       public void acquire() throws InterruptedException {\r
-               \r
-               if (Thread.interrupted()) \r
-                       throw new InterruptedException();\r
-               \r
-               synchronized(this) {\r
-               \r
-                       try {\r
-                                       while (permits_ <= 0) \r
-                                               wait();\r
-                                       \r
-                                       --permits_;\r
-                       }\r
-                       catch (InterruptedException ex) {\r
-                               notify();\r
-                               throw ex;\r
-                       }\r
-               }\r
-       }\r
-\r
-       public synchronized void release() {\r
-               ++(this.permits_);\r
-               notify();\r
-       }\r
-}\r
+ */  \r
+\rpackage simgrid.msg;
+\r\rpublic class Sem {\r
+       /******************************************************************/ \r
+       /* Simple semaphore implementation, from Doug Lea (public domain) */ \r
+       /******************************************************************/ \r
+       private int permits_;
+\r      public Sem(int i) {\r            permits_ = i;\r  } \r\r    public void acquire() throws InterruptedException {
+               if (Thread.interrupted())
+                       throw new InterruptedException();
+\r              synchronized(this) {
+                       try {
+                               while (permits_ <= 0)
+                                       wait();
+                               --permits_;
+                       }
+                       catch(InterruptedException ex) {
+                               notify();
+                               throw ex;
+                       }
+               }
+       }
+\r      public synchronized void release() {
+               ++(this.permits_);
+               notify();
+       } \r\r