Refactoring

This commit is contained in:
M66B 2020-08-28 09:13:52 +02:00
parent 0d645f7ff5
commit 4b21324cfa
1 changed files with 10 additions and 4 deletions

View File

@ -4149,13 +4149,19 @@ class Core {
void join(Thread thread) {
boolean joined = false;
boolean interrupted = false;
String name = thread.getName();
while (!joined)
try {
Log.i("Joining " + thread.getName() +
" state=" + thread.getState() + " alive=" + thread.isAlive());
Log.i("Joining " + name +
" alive=" + thread.isAlive() +
" state=" + thread.getState());
thread.join(JOIN_WAIT);
// https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html
Thread.State state = thread.getState();
if (thread.isAlive()) {
Log.e("Join failed state=" + thread.getState() + " interrupted=" + interrupted);
Log.e("Join " + name + " failed state=" + state + " interrupted=" + interrupted);
if (interrupted)
joined = true; // give up
else {
@ -4163,7 +4169,7 @@ class Core {
interrupted = true;
}
} else {
Log.i("Joined " + thread.getName() + " state=" + thread.getState());
Log.i("Joined " + name + " " + " state=" + state);
joined = true;
}
} catch (InterruptedException ex) {