-/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
package org.simgrid.msg;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
/**
* A process may be defined as a code, with some private data, executing
/**
* This method kills all running process of the simulation.
- *
- * @return The function returns the PID of the next created process.
- *
*/
- public static native int killAll();
+ public static native void killAll();
/** Simply kills the receiving process.
*
public native void migrate(Host host);
/**
* Makes the current process sleep until millis milliseconds have elapsed.
- * You should note that unlike "waitFor" which takes seconds, this method takes milliseconds.
- * FIXME: Not optimal, maybe we should have two native functions.
+ * You should note that unlike "waitFor" which takes seconds (as usual in SimGrid), this method takes milliseconds (as usual for sleep() in Java).
+ *
* @param millis the length of time to sleep in milliseconds.
*/
public static void sleep(long millis) throws HostFailureException {
Msg.info("Unexpected behavior. Stopping now");
System.exit(1);
}
- catch(ProcessKilledError pk) {
- /* The process was killed before its end. With a kill() or something. */
- }
+ /* Let the ProcessKilledError (that we'd get if the process is forcefully killed) flow back to the caller */
}
/**
*/
public static native int getCount();
+ public static void debugAllThreads() {
+ // Search remaining threads that are not main nor daemon
+ for (Thread t : Thread.getAllStackTraces().keySet())
+ if (! t.isDaemon() && !t.getName().equals("main"))
+ System.err.println("Thread "+t.getName()+" is still running! Please report that bug");
+ }
}