Fix duration in multi-threaded mode.
This commit is contained in:
@@ -338,7 +338,7 @@ class ThreadPool extends WorkOutput
|
||||
}
|
||||
while (!Std.isOfType(job, ThreadEvent));
|
||||
|
||||
output.resetJobProgress();
|
||||
output.resetJobProgress(timestamp());
|
||||
}
|
||||
|
||||
if (job.event == EXIT)
|
||||
@@ -377,7 +377,7 @@ class ThreadPool extends WorkOutput
|
||||
else if(Std.isOfType(interruption, ThreadEvent))
|
||||
{
|
||||
job = interruption;
|
||||
output.resetJobProgress();
|
||||
output.resetJobProgress(timestamp());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -390,7 +390,7 @@ class ThreadPool extends WorkOutput
|
||||
}
|
||||
#end
|
||||
|
||||
private inline function timestamp():Float
|
||||
private static inline function timestamp():Float
|
||||
{
|
||||
#if sys
|
||||
return Sys.cpuTime();
|
||||
|
||||
@@ -166,9 +166,14 @@ class WorkOutput
|
||||
}
|
||||
}
|
||||
|
||||
private inline function resetJobProgress():Void
|
||||
/**
|
||||
@param now `WorkOutput` won't compile if it includes any references to
|
||||
`haxe.Timer`, so the child class must supply the current time instead.
|
||||
**/
|
||||
private inline function resetJobProgress(now:Float):Void
|
||||
{
|
||||
__jobComplete.value = false;
|
||||
__jobStartTime.value = now;
|
||||
workIterations.value = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user