diff options
author | Ben Pfaff <blp@nicira.com> | 2010-05-12 12:53:07 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-05-26 11:46:59 -0700 |
commit | 7cf8b2660f9813fe080a3f4fcc975099cb36417a (patch) | |
tree | e508a0001469854f18e185c7b93b79af06c9906d /extras | |
parent | 8bf4bbe390af3f370e7e95d9237572ff750047a8 (diff) |
poll-loop: New function poll_timer_wait_until().
Many of poll_timer_wait()'s callers actually want to wait until a specific
time, so it's convenient for them to offer a function that does this.
Diffstat (limited to 'extras')
-rw-r--r-- | extras/ezio/ezio-term.c | 11 | ||||
-rw-r--r-- | extras/ezio/ovs-switchui.c | 8 |
2 files changed, 6 insertions, 13 deletions
diff --git a/extras/ezio/ezio-term.c b/extras/ezio/ezio-term.c index cedc5c96..d96122bc 100644 --- a/extras/ezio/ezio-term.c +++ b/extras/ezio/ezio-term.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2009 Nicira Networks, Inc. +/* Copyright (c) 2008, 2009, 2010 Nicira Networks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -907,14 +907,7 @@ scanner_run(struct scanner *s, struct ezio *ezio) static void scanner_wait(struct scanner *s) { - long long int now = time_msec(); - long long int expires = s->last_move + 750; - if (now >= expires) { - poll_immediate_wake(); - } else { - poll_timer_wait(expires - now); - } - + poll_timer_wait_until(s->last_move + 750); } static void diff --git a/extras/ezio/ovs-switchui.c b/extras/ezio/ovs-switchui.c index 16a6903f..6ebfecee 100644 --- a/extras/ezio/ovs-switchui.c +++ b/extras/ezio/ovs-switchui.c @@ -242,7 +242,7 @@ main(int argc, char *argv[]) refresh(); poll_fd_wait(STDIN_FILENO, POLLIN); - poll_timer_wait(timeout - time_msec()); + poll_timer_wait_until(timeout); poll_block(); } while (time_msec() < timeout); age_messages(); @@ -868,7 +868,7 @@ fetch_status(struct rconn *rconn, struct dict *dict, long long timeout) rconn_run_wait(rconn); rconn_recv_wait(rconn); - poll_timer_wait(timeout - time_msec()); + poll_timer_wait_until(timeout); poll_block(); } } @@ -1714,7 +1714,7 @@ menu_show(const struct menu *menu, int start, bool select) refresh(); if (pos < min || pos > max) { - poll_timer_wait(adjust - time_msec()); + poll_timer_wait_until(adjust); } poll_fd_wait(STDIN_FILENO, POLLIN); poll_block(); @@ -1946,7 +1946,7 @@ static void block_until(long long timeout) { while (timeout > time_msec()) { - poll_timer_wait(timeout - time_msec()); + poll_timer_wait_until(timeout); poll_block(); } drain_keyboard_buffer(); |