Refactoring

pull/184/head
M66B 4 years ago
parent 0d645f7ff5
commit 4b21324cfa

@ -4149,13 +4149,19 @@ class Core {
void join(Thread thread) { void join(Thread thread) {
boolean joined = false; boolean joined = false;
boolean interrupted = false; boolean interrupted = false;
String name = thread.getName();
while (!joined) while (!joined)
try { try {
Log.i("Joining " + thread.getName() + Log.i("Joining " + name +
" state=" + thread.getState() + " alive=" + thread.isAlive()); " alive=" + thread.isAlive() +
" state=" + thread.getState());
thread.join(JOIN_WAIT); 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()) { if (thread.isAlive()) {
Log.e("Join failed state=" + thread.getState() + " interrupted=" + interrupted); Log.e("Join " + name + " failed state=" + state + " interrupted=" + interrupted);
if (interrupted) if (interrupted)
joined = true; // give up joined = true; // give up
else { else {
@ -4163,7 +4169,7 @@ class Core {
interrupted = true; interrupted = true;
} }
} else { } else {
Log.i("Joined " + thread.getName() + " state=" + thread.getState()); Log.i("Joined " + name + " " + " state=" + state);
joined = true; joined = true;
} }
} catch (InterruptedException ex) { } catch (InterruptedException ex) {

Loading…
Cancel
Save