Skip to content

Commit 8a91339

Browse files
committed
Fix timeout in kqueue
1 parent cd3fb1d commit 8a91339

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static int ev_api_poll(ev_context *ctx, time_t timeout)
770770
{
771771
struct kqueue_api *k_api = ctx->api;
772772
struct timespec ts_timeout;
773-
ts_timeout.tv_sec = timeout;
773+
ts_timeout.tv_sec = timeout < 0 ? 0 : timeout;
774774
ts_timeout.tv_nsec = 0;
775775
int err = kevent(k_api->fd, NULL, 0, k_api->events, ctx->maxevents,
776776
timeout > 0 ? &ts_timeout : NULL);

0 commit comments

Comments
 (0)