Skip to content

Commit

Permalink
reduce idle CPU consumption by the stream listener
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Feb 21, 2024
1 parent 50fc0c9 commit d21b5e5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tateyama/endpoint/stream/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,11 @@ class connection_socket
std::shared_ptr<stream_socket> accept(const std::function<void(void)>& cleanup = [](){} ) {
cleanup();

struct timeval tv{};
tv.tv_sec = 1; // 1(S)
tv.tv_usec = 0;
while (true) {
struct timeval tv{};
tv.tv_sec = 1; // 1(S)
tv.tv_usec = 0;

FD_ZERO(&fds_); // NOLINT
if (is_socket_available()) {
FD_SET(socket_, &fds_); // NOLINT
Expand Down

1 comment on commit d21b5e5

@t-horikawa
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.