@@ -224,43+224,17 @@ public abstract class Process extends Thread {
{
return nativeStop;
}
- /**
- * checks if the flag that indicates that this thread must be killed is set to true; if true, starts to kill it. End users should not have to deal with it
- * If you develop a new MSG native call, please include a call to interruptedStop() at the beginning of your method code, so as the process can be killed if he call
- * your method.
- *
- * @return
- *
- */
- public static void ifInterruptedStop() {
- if ( (Thread.currentThread() instanceof Process) &&((Process) Thread.currentThread()).getNativeStop()) {
- throw new RuntimeException("Interrupted");
- }
- }
-
/**
* This method kill a process.
* @param process the process to be killed.
*
*/
- public static void kill(Process process) {
- process.nativeStop();
- Msg.info("Process " + process.msgName() + " will be killed.");
+ public void kill() {
+ nativeStop();
+ Msg.info("Process " + msgName() + " will be killed.");
}
- /**
- * This method adds an argument in the list of the arguments of the main function
- * of the process.
- *
- * @param arg The argument to add.
- *
- * @deprecated
- */
- @Deprecated
- protected void addArg(String arg) {
- args.add(arg);
- }
/**
* Suspends the process by suspending the task on which it was
@@ -268,7+242,6 @@ public abstract class Process extends Thread {
*
*/
public void pause() {
- Process.ifInterruptedStop();
MsgNative.processSuspend(this);
}
/**
@@ -278,7+251,6 @@ public abstract class Process extends Thread {
*
*/
public void restart() {
- Process.ifInterruptedStop();
MsgNative.processResume(this);
}
/**
@@ -288,7+260,6 @@ public abstract class Process extends Thread {
* Otherwise the method returns false.
*/
public boolean isSuspended() {
- Process.ifInterruptedStop();
return MsgNative.processIsSuspended(this);
}
/**
@@ -299,7+270,6 @@ public abstract class Process extends Thread {
*
*/
public Host getHost() {
- Process.ifInterruptedStop();
if (this.host == null) {
this.host = MsgNative.processGetHost(this);
}
@@ -315,7+285,6 @@ public abstract class Process extends Thread {
* @exception NativeException on error in the native SimGrid code
*/
public static Process fromPID(int PID) throws NativeException {
- Process.ifInterruptedStop();
return MsgNative.processFromPID(PID);
}
/**
@@ -325,7+294,6 @@ public abstract class Process extends Thread {
*
*/
public int getPID() {
- Process.ifInterruptedStop();
if (pid == -1) {
pid = MsgNative.processGetPID(this);
}
@@ -338,7+306,6 @@ public abstract class Process extends Thread {
*
*/
public int getPPID() {
- Process.ifInterruptedStop();
if (ppid == -1) {
ppid = MsgNative.processGetPPID(this);
}
@@ -351,7+318,6 @@ public abstract class Process extends Thread {
*
*/
public static Process currentProcess() {
- Process.ifInterruptedStop();
return MsgNative.processSelf();
}
/**
@@ -362,7+328,6 @@ public abstract class Process extends Thread {
*
*/
public static void migrate(Process process, Host host) {
- Process.ifInterruptedStop();
MsgNative.processMigrate(process, host);
process.host = null;
}
@@ -374,14+339,12 @@ public abstract class Process extends Thread {
* @exception HostFailureException on error in the native SimGrid code
*/
public static void waitFor(double seconds) throws HostFailureException {