1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-29 12:57:46 +00:00

Allow pausing Lua machines

TimeoutState now introduces a TIMESLICE, which is the maximum period of
time a computer can run before we will look into pausing it.

When we have executed a task for more than this period, and if there are
other computers waiting to execute work, then we will suspend the
machine.

Suspending the machine sets a flag on the ComputerExecutor, and pauses
the "cumulative" time - the time spent handling this particular event.
When resuming the machine, we restart our timer and resume the machine.
This commit is contained in:
SquidDev
2019-02-28 16:36:26 +00:00
parent 218f8e53bb
commit b3e6a53868
6 changed files with 194 additions and 30 deletions

View File

@@ -84,10 +84,10 @@ public class ComputerBootstrap
if( computer.isOn() || !api.didAssert )
{
StringBuilder builder = new StringBuilder().append( "Did not correctly" );
StringBuilder builder = new StringBuilder().append( "Did not correctly [" );
if( !api.didAssert ) builder.append( " assert" );
if( computer.isOn() ) builder.append( " shutdown" );
builder.append( "\n" );
builder.append( " ]\n" );
for( int line = 0; line < 19; line++ )
{