Skip to content

Commit

Permalink
[task-runner] only perform read when FD is set (#2697)
Browse files Browse the repository at this point in the history
  • Loading branch information
Irving-cl authored Feb 7, 2025
1 parent eb54f60 commit 3ad3db8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/common/task_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ void TaskRunner::Update(MainloopContext &aMainloop)

void TaskRunner::Process(const MainloopContext &aMainloop)
{
OTBR_UNUSED_VARIABLE(aMainloop);

ssize_t rval;

VerifyOrExit(FD_ISSET(mEventFd[kRead], &aMainloop.mReadFdSet));

// Read any data in the pipe.
do
{
Expand All @@ -125,6 +125,7 @@ void TaskRunner::Process(const MainloopContext &aMainloop)
// Critical error happens, simply die.
VerifyOrDie(errno == EAGAIN || errno == EWOULDBLOCK, strerror(errno));

exit:
PopTasks();
}

Expand Down

0 comments on commit 3ad3db8

Please sign in to comment.