org/simgrid/msg/Process.java
org/simgrid/msg/ProcessKilled.java
org/simgrid/msg/ProcessNotFoundException.java
- org/simgrid/msg/Sem.java
org/simgrid/msg/Task.java
org/simgrid/msg/TaskCancelledException.java
org/simgrid/msg/TimeoutException.java
SimGrid-java (3.6.1) unstable; urgency=low
+
+ * Do not embeed our version of semaphores, java 1.5 can be considered
+ as sufficiently prevalent for us to not dupplicate its features.
* Make Process.kill(process) an instance method, not a static one
* Fix a bug around Process.kill()
* Add dsend and simulatedSleep to the bindings.
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
+import java.util.concurrent.Semaphore;
/**
* A process may be defined as a code, with some private data, executing
/**
*
*/
- protected Sem schedBegin, schedEnd;
+ protected Semaphore schedBegin, schedEnd;
private boolean nativeStop = false;
/**
this.bind = 0;
this.args = new Vector<String>();
this.properties = null;
- schedBegin = new Sem(0);
- schedEnd = new Sem(0);
+ schedBegin = new Semaphore(0);
+ schedEnd = new Semaphore(0);
}
+++ /dev/null
-/*\r
- * Simple semaphore implementation, from Doug Lea (public domain)\r
- *\r
- * Copyright 2006,2007,2010,2011 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 org.simgrid.msg;\r
-\r
-public class Sem {\r
- /******************************************************************/ \r
- /* Simple semaphore implementation, from Doug Lea (public domain) */ \r
- /******************************************************************/ \r
- private int permits_;\r
-\r
- /**\r
- *\r
- * @param i\r
- */\r
- public Sem(int i) {\r
- permits_ = i;\r
- } \r
-\r
- /**\r
- *\r
- * @throws java.lang.InterruptedException\r
- */\r
- public void acquire() throws InterruptedException {\r
- if (Thread.interrupted())\r
- throw new InterruptedException();\r
-\r
- synchronized(this) {\r
- try {\r
- while (permits_ <= 0)\r
- wait();\r
- --permits_;\r
- }\r
- catch(InterruptedException ex) {\r
- notify();\r
- throw ex;\r
- }\r
- }\r
- }\r
-\r
- /**\r
- *\r
- */\r
- public synchronized void release() {\r
- ++(this.permits_);\r
- notify();\r
- } \r
-} \r