diff --git a/chronos/asyncfutures2.nim b/chronos/asyncfutures2.nim index 34920c0..82ccd44 100644 --- a/chronos/asyncfutures2.nim +++ b/chronos/asyncfutures2.nim @@ -319,6 +319,9 @@ proc futureContinue*(fut: FutureBase) {.raises: [], gcsafe.} = var next: FutureBase template iterate = while true: + when chronosFuturesInstrumentation: + if not(isNil(onFutureRunning)): + onFutureRunning(fut) # Call closure to make progress on `fut` until it reaches `yield` (inside # `await` typically) or completes / fails / is cancelled next = fut.internalClosure(fut) diff --git a/tests/testutils.nim b/tests/testutils.nim index e3ee1b8..72800d3 100644 --- a/tests/testutils.nim +++ b/tests/testutils.nim @@ -247,6 +247,7 @@ suite "Asynchronous utilities test suite": echo "avg wallTime:\t", v.totalWallTime div count, "\ttotal: ", v.totalWallTime echo "avg runTime:\t", v.totalRunTime div count, "\ttotal: ", v.totalRunTime if k.procedure == "simpleAsync1": + echo "v: ", v check v.totalExecTime >= 150.milliseconds() check v.totalExecTime <= 180.milliseconds()