Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[hw] Eliminate polling while waiting for window to open
Polling for the data-transfer window to become open is wasteful.  We
can eliminate the polling loop by using hw_step() as the handler for
an xfer_window_changed() event.

If the window is already open at the time of instantiation, then
xfer_window_changed() may never be called.  We can cover this case by
using hw_step() as the step() method of a one-shot process.  Since the
signature for an xfer_window_changed() method is identical to the
signature for a process step() method, the same function can be used
for both.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Jun 28, 2011
1 parent 019d4c1 commit 3915b66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/hw.c
Expand Up @@ -36,14 +36,15 @@ static void hw_step ( struct hw *hw ) {
}

static struct interface_operation hw_xfer_operations[] = {
INTF_OP ( xfer_window_changed, struct hw *, hw_step ),
INTF_OP ( intf_close, struct hw *, hw_finished ),
};

static struct interface_descriptor hw_xfer_desc =
INTF_DESC ( struct hw, xfer, hw_xfer_operations );

static struct process_descriptor hw_process_desc =
PROC_DESC ( struct hw, process, hw_step );
PROC_DESC_ONCE ( struct hw, process, hw_step );

static int hw_open ( struct interface *xfer, struct uri *uri __unused ) {
struct hw *hw;
Expand Down

0 comments on commit 3915b66

Please sign in to comment.