Skip to content

Commit

Permalink
Fix 100% CPU usage because of wait_until
Browse files Browse the repository at this point in the history
  • Loading branch information
magiblot committed Oct 21, 2024
1 parent 85713c9 commit 42df256
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/tvterm-core/termctrl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ void TerminalController::TerminalEventLoop::runWriterLoop() noexcept
bool updated = false;
{
std::unique_lock<std::mutex> lock(mutex);
condVar.wait_until(lock, currentTimeout);
if (currentTimeout != TimePoint::max())
condVar.wait_until(lock, currentTimeout);
else
// Waiting until 'TimePoint::max()' is not always supported,
// so use a regular 'wait'.
condVar.wait(lock);

if (terminated)
{
Expand Down

0 comments on commit 42df256

Please sign in to comment.