Skip to content

leverage of new kevent timer granularity functionality #113

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

Merged
merged 1 commit into from
Jul 20, 2016
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/shims/linux_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ typedef void (*dispatch_mach_msg_destructor_t)(void*);

#define IGNORE_KEVENT64_EXT /* will force the kevent64_s.ext[] to not be used -> leeway ignored */

#ifndef NOTE_SECONDS
#define NOTE_SECONDS 0x01
#define NOTE_USECONDS 0x02
#define NOTE_NSECONDS 0x04
#define NOTE_ABSOLUTE 0x08
#define KEVENT_NSEC_NOT_SUPPORTED
#endif
#define NOTE_CRITICAL 0x10
#define NOTE_BACKGROUND 0x20
#define NOTE_LEEWAY 0x40
Expand Down
4 changes: 4 additions & 0 deletions src/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -2341,11 +2341,15 @@ _dispatch_kevent_timer_set_delay(_dispatch_kevent_qos_s *ke, uint64_t delay,
{
// call to update nows[]
_dispatch_source_timer_now(nows, DISPATCH_TIMER_KIND_WALL);
#if KEVENT_NSEC_NOT_SUPPORTED
// adjust nsec based delay to msec based and ignore leeway
delay /= 1000000L;
if ((int64_t)(delay) <= 0) {
delay = 1; // if value <= 0 the dispatch will stop
}
#else
ke->fflags |= NOTE_NSECONDS;
#endif
ke->data = (int64_t)delay;
}

Expand Down