Skip to content

Commit

Permalink
For old thread_usleep API
Browse files Browse the repository at this point in the history
  • Loading branch information
Coldwings committed Sep 10, 2024
1 parent 5b063be commit bdf2350
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion io/epoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class EventEngineEPoll : public MasterEventEngine, public CascadingEventEngine {
if (ret < 0) LOG_ERROR_RETURN(0, -1, "failed to add event interest");
// if timeout is just simple 0, wait for a tiny little moment
// so that events can be collect.
ret = thread_usleep(timeout.timeout() ? timeout : Timeout(10));
ret = thread_usleep(timeout ? timeout : 10);
ERRNO err;
if (ret == -1 && err.no == EOK) {
return 0; // Event arrived
Expand Down
2 changes: 1 addition & 1 deletion io/kqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class KQueue : public MasterEventEngine, public CascadingEventEngine {
int wait_for_fd(int fd, uint32_t interests, uint64_t timeout) override {
short ev = (interests == EVENT_READ) ? EVFILT_READ : EVFILT_WRITE;
enqueue(fd, ev, EV_ADD | EV_ONESHOT, 0, CURRENT);
int ret = thread_usleep(timeout.timeout() ? timeout : Timeout(10));
int ret = thread_usleep(timeout ? timeout : 10);
ERRNO err;
if (ret == -1 && err.no == EOK) {
return 0; // event arrived
Expand Down
1 change: 0 additions & 1 deletion net/pooled_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ class TCPSocketPool : public ForwardSocketClient {

bool release(EndPoint ep, ISocketStream* stream) {
auto fd = stream->get_underlay_fd();
ERRNO err;
if (!stream_reusable(fd)) return false;
auto node = new StreamListNode(ep, stream, fd, expiration);
push_into_pool(node);
Expand Down

0 comments on commit bdf2350

Please sign in to comment.