Browse Source

[retry] Add start_timer_fixed()

Allow for timers to be started with fixed timeouts.
tags/v0.9.4
Michael Brown 16 years ago
parent
commit
32e8ab4df0
2 changed files with 17 additions and 6 deletions
  1. 13
    1
      src/include/gpxe/retry.h
  2. 4
    5
      src/net/retry.c

+ 13
- 1
src/include/gpxe/retry.h View File

@@ -35,9 +35,21 @@ struct retry_timer {
35 35
 };
36 36
 
37 37
 extern void start_timer ( struct retry_timer *timer );
38
-extern void start_timer_nodelay ( struct retry_timer *timer );
38
+extern void start_timer_fixed ( struct retry_timer *timer,
39
+				unsigned long timeout );
39 40
 extern void stop_timer ( struct retry_timer *timer );
40 41
 
42
+/**
43
+ * Start timer with no delay
44
+ *
45
+ * @v timer		Retry timer
46
+ *
47
+ * This starts the timer running with a zero timeout value.
48
+ */
49
+static inline void start_timer_nodelay ( struct retry_timer *timer ) {
50
+	start_timer_fixed ( timer, 0 );
51
+}
52
+
41 53
 /**
42 54
  * Test to see if timer is currently running
43 55
  *

+ 4
- 5
src/net/retry.c View File

@@ -74,15 +74,14 @@ void start_timer ( struct retry_timer *timer ) {
74 74
 }
75 75
 
76 76
 /**
77
- * Start timer with no delay
77
+ * Start timer with a specified fixed timeout
78 78
  *
79 79
  * @v timer		Retry timer
80
- *
81
- * This starts the timer running with a zero timeout value.
80
+ * @v timeout		Timeout, in ticks
82 81
  */
83
-void start_timer_nodelay ( struct retry_timer *timer ) {
82
+void start_timer_fixed ( struct retry_timer *timer, unsigned long timeout ) {
84 83
 	start_timer ( timer );
85
-	timer->timeout = 0;
84
+	timer->timeout = timeout;
86 85
 }
87 86
 
88 87
 /**

Loading…
Cancel
Save