@@ -54,14 +54,19 @@ public class JniHelper {
|
||||
? new ErrnoException("kill", errno) : new Exception("kill failed: " + errno);
|
||||
}
|
||||
|
||||
@Deprecated // Use Process.destroy() since API 24
|
||||
public static int waitpidCompat(Process process) throws Exception {
|
||||
@Deprecated // only implemented for before API 24
|
||||
public static boolean waitForCompat(Process process, long millis) throws Exception {
|
||||
if (Build.VERSION.SDK_INT >= 24) throw new UnsupportedOperationException("Never call this method in OpenJDK!");
|
||||
return waitpid(process);
|
||||
final Object mutex = getExitValueMutex(process);
|
||||
synchronized (mutex) {
|
||||
if (getExitValue(process) == null) mutex.wait(millis);
|
||||
return getExitValue(process) != null;
|
||||
}
|
||||
}
|
||||
|
||||
private static native int sigterm(Process process);
|
||||
private static native int waitpid(Process process);
|
||||
private static native Integer getExitValue(Process process);
|
||||
private static native Object getExitValueMutex(Process process);
|
||||
public static native int sendFd(int fd, String path);
|
||||
public static native void close(int fd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user