1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-05-08 18:34:12 +00:00

Rethrow/retrigger interrupted status where appropriate

This commit is contained in:
SquidDev 2017-05-10 11:17:44 +01:00
parent 85c556d324
commit 5f323a85a7

View File

@ -93,6 +93,13 @@ public class ComputerThread
} }
} }
} }
synchronized( s_taskLock )
{
s_computerTaskQueues.clear();
s_computerTasksActive.clear();
s_computerTasksActiveSet.clear();
}
} }
/** /**
@ -157,10 +164,11 @@ public class ComputerThread
} }
catch( InterruptedException ignored ) catch( InterruptedException ignored )
{ {
Thread.currentThread().interrupt();
} }
} }
private void execute( BlockingQueue<ITask> queue ) private void execute( BlockingQueue<ITask> queue ) throws InterruptedException
{ {
ITask task = queue.remove(); ITask task = queue.remove();
@ -207,10 +215,8 @@ public class ComputerThread
} }
} }
} }
catch( InterruptedException ignored ) finally
{ {
}
// Re-add it back onto the queue or remove it // Re-add it back onto the queue or remove it
synchronized( s_taskLock ) synchronized( s_taskLock )
{ {
@ -225,6 +231,7 @@ public class ComputerThread
} }
} }
} }
}
/** /**
* Responsible for the actual running of tasks. It waitin for the {@link TaskRunner#input} semaphore to be * Responsible for the actual running of tasks. It waitin for the {@link TaskRunner#input} semaphore to be
@ -248,7 +255,7 @@ public class ComputerThread
{ {
task.execute(); task.execute();
} }
catch( Throwable e ) catch( RuntimeException e )
{ {
ComputerCraft.log.error( "Error running task.", e ); ComputerCraft.log.error( "Error running task.", e );
} }
@ -259,6 +266,7 @@ public class ComputerThread
catch( InterruptedException e ) catch( InterruptedException e )
{ {
ComputerCraft.log.error( "Error running task.", e ); ComputerCraft.log.error( "Error running task.", e );
Thread.currentThread().interrupt();
} }
} }