Skip to content

Commit

Permalink
DelayedSeek: inline Cancel() and OnTimer()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 11, 2024
1 parent 392332e commit b302aad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
18 changes: 0 additions & 18 deletions src/DelayedSeek.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@ DelayedSeek::Commit() noexcept
id = -1;
}

void
DelayedSeek::Cancel() noexcept
{
commit_timer.Cancel();
}

void
DelayedSeek::OnTimer() noexcept
{
Commit();
}

void
DelayedSeek::ScheduleTimer() noexcept
{
commit_timer.Schedule(std::chrono::milliseconds(500));
}

bool
DelayedSeek::Seek(int offset) noexcept
{
Expand Down
15 changes: 12 additions & 3 deletions src/DelayedSeek.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ public:
bool Seek(int offset) noexcept;

void Commit() noexcept;
void Cancel() noexcept;

void Cancel() noexcept {
commit_timer.Cancel();
}


private:
void OnTimer() noexcept;
void ScheduleTimer() noexcept;
void OnTimer() noexcept {
Commit();
}

void ScheduleTimer() noexcept {
commit_timer.Schedule(std::chrono::milliseconds(500));
}
};

0 comments on commit b302aad

Please sign in to comment.