Skip to content

Commit

Permalink
make the check interval adjustment work for more situations
Browse files Browse the repository at this point in the history
call adjust_check_interval before calling check_interrupt
so that it works for the recently added `toywasm --timeout`.
(at least when user_intr_delay > 0.)
  • Loading branch information
yamt committed Jun 18, 2023
1 parent 3f9a06e commit 9c5adc6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,13 +1074,6 @@ exec_expr_continue(struct exec_context *ctx)
}
n--;
if (__predict_false(n == 0)) {
ret = check_interrupt(ctx);
if (ret != 0) {
if (IS_RESTARTABLE(ret)) {
STAT_INC(ctx->stats.exec_loop_restart);
}
return ret;
}
struct timespec now;
ret = timespec_now(CLOCK_MONOTONIC, &now);
if (ret != 0) {
Expand All @@ -1091,6 +1084,13 @@ exec_expr_continue(struct exec_context *ctx)
}
last = now;
has_last = true;
ret = check_interrupt(ctx);
if (ret != 0) {
if (IS_RESTARTABLE(ret)) {
STAT_INC(ctx->stats.exec_loop_restart);
}
return ret;
}
n = ctx->check_interval;
assert(n > 0);
}
Expand Down

0 comments on commit 9c5adc6

Please sign in to comment.