Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mk_core: fix timeout given to EVFILT_TIMER in some BSD #11

Merged
merged 1 commit into from
Jun 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/mk_core/mk_event_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,13 @@ static inline int _mk_event_timeout_create(struct mk_event_ctx *ctx,
event->type = MK_EVENT_NOTIFICATION;
event->mask = MK_EVENT_EMPTY;

#ifdef NOTE_SECONDS
/* FreeBSD or LINUX_KQUEUE defined */
EV_SET(&ke, fd, EVFILT_TIMER, EV_ADD, NOTE_SECONDS, expire, event);
#else
/* Other BSD have no NOTE_SECONDS & specify milliseconds */
EV_SET(&ke, fd, EVFILT_TIMER, EV_ADD, 0, expire * 1000, event);
#endif
ret = kevent(ctx->kfd, &ke, 1, NULL, 0, NULL);
if (ret < 0) {
close(fd);
Expand Down