Skip to content

Commit

Permalink
feat: support task deadlines (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Jun 5, 2024
1 parent aa9ff14 commit 23beba0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions builtins/web/timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class TimerTask final : public api::AsyncTask {
return true;
}

[[nodiscard]] uint64_t deadline() override {
return deadline_;
}

void trace(JSTracer *trc) override {
TraceEdge(trc, &callback_, "Timer callback");
for (auto &arg : arguments_) {
Expand Down
4 changes: 4 additions & 0 deletions include/extension-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class AsyncTask {
return handle_;
}

[[nodiscard]] virtual uint64_t deadline() {
return 0;
}

virtual void trace(JSTracer *trc) = 0;

/**
Expand Down

0 comments on commit 23beba0

Please sign in to comment.