Skip to content

Commit

Permalink
Merge pull request #11 from enukane/mk_core_netbsd
Browse files Browse the repository at this point in the history
mk_core: fix timeout given to EVFILT_TIMER in some BSD
  • Loading branch information
edsiper committed Jun 4, 2015
2 parents eed832a + 9b07207 commit 0a591a3
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 0a591a3

Please sign in to comment.