Skip to content

A few updates to enable building on Raspberry PI/Ubuntu 16.04 #318

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
Oct 25, 2017
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
2 changes: 1 addition & 1 deletion src/event/event_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ _dispatch_timeout_program(uint32_t tidx, uint64_t target,

if (target < INT64_MAX) {
struct itimerspec its = { .it_value = {
.tv_sec = target / NSEC_PER_SEC,
.tv_sec = (time_t)(target / NSEC_PER_SEC),
.tv_nsec = target % NSEC_PER_SEC,
} };
dispatch_assume_zero(timerfd_settime(timer->det_fd, TFD_TIMER_ABSTIME,
Expand Down
8 changes: 4 additions & 4 deletions src/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -2023,15 +2023,15 @@ static inline unsigned long
_dispatch_source_timer_data(dispatch_source_t ds, dispatch_unote_t du)
{
dispatch_timer_source_refs_t dr = du._dt;
unsigned long data, prev, clear_prev = 0;
uint64_t data, prev, clear_prev = 0;

os_atomic_rmw_loop2o(ds, ds_pending_data, prev, clear_prev, relaxed, {
data = prev >> 1;
if (unlikely(prev & DISPATCH_TIMER_MISSED_MARKER)) {
os_atomic_rmw_loop_give_up(goto handle_missed_intervals);
}
});
return data;
return (unsigned long)data;

handle_missed_intervals:
// The timer may be in _dispatch_source_invoke2() already for other
Expand All @@ -2046,7 +2046,7 @@ _dispatch_source_timer_data(dispatch_source_t ds, dispatch_unote_t du)
uint64_t now = _dispatch_time_now(DISPATCH_TIMER_CLOCK(dr->du_ident));
if (now >= dr->dt_timer.target) {
OS_COMPILER_CAN_ASSUME(dr->dt_timer.interval < INT64_MAX);
data = _dispatch_source_timer_compute_missed(dr, now, data);
data = _dispatch_source_timer_compute_missed(dr, now, (unsigned long)data);
}

// When we see the MISSED_MARKER the manager has given up on this timer
Expand All @@ -2059,7 +2059,7 @@ _dispatch_source_timer_data(dispatch_source_t ds, dispatch_unote_t du)
// on the manager and make the changes to `ds_timer` above visible.
_dispatch_queue_atomic_flags_clear(ds->_as_dq, DSF_ARMED);
os_atomic_store2o(ds, ds_pending_data, 0, relaxed);
return data;
return (unsigned long)data;
}

static inline void
Expand Down
2 changes: 1 addition & 1 deletion tests/dispatch_starfish.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ collect(void *context __attribute__((unused)))

printf("lap: %zd\n", lap_count_down);
printf("count: %lu\n", COUNT);
printf("delta: %lu ns\n", delta);
printf("delta: %lu ns\n", (unsigned long)delta);
printf("math: %Lf ns / lap\n", math);

for (i = 0; i < COUNT; i++) {
Expand Down
4 changes: 2 additions & 2 deletions tests/dispatch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ test_timer(void)

dispatch_source_set_event_handler(s, ^{
if (!finalized) {
test_long_less_than("timer number", j, stop_at);
fprintf(stderr, "timer[%lu]\n", j);
test_long_less_than("timer number", (long)j, stop_at);
fprintf(stderr, "timer[%lu]\n", (unsigned long)j);
}
dispatch_release(s);
});
Expand Down