Skip to content

Commit

Permalink
Use EnterSleep in ChannelClient synchronous communication instead of …
Browse files Browse the repository at this point in the history
…Schedule.

This avoid unneeded spinning especially when doing local inter process communication.
  • Loading branch information
nieklinnenbank committed Jan 13, 2016
1 parent 58d6671 commit 0e97f3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/libfs/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ Error FileSystem::processRequest(FileSystemRequest *req)
DEBUG(m_self << ": not found");
msg->result = ENOENT;
m_registry->getProducer(msg->from)->write(msg);
#warning put this in ChannelClient somehow
ProcessCtl(msg->from, Resume, 0);
return msg->result;
}

Expand Down Expand Up @@ -249,6 +251,7 @@ Error FileSystem::processRequest(FileSystemRequest *req)
if (msg->result != EAGAIN)
{
m_registry->getProducer(msg->from)->write(msg);
ProcessCtl(msg->from, Resume, 0);
}
return msg->result;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/libipc/ChannelClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ ChannelClient::Result ChannelClient::syncReceiveFrom(void *buffer, ProcessID pid
#warning use Sleep instead to avoid unneeded spinning

while (ch->read(buffer) != Channel::Success)
ProcessCtl(SELF, Schedule, 0);
ProcessCtl(SELF, EnterSleep, 0);

return Success;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/libipc/ChannelServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ template <class Base, class MsgType> class ChannelServer
{
ERROR(m_self << ": failed to send reply message to PID: " << i.key());
}
else
ProcessCtl(i.key(), Resume, 0);
}
}
}
Expand Down

0 comments on commit 0e97f3e

Please sign in to comment.