Skip to content

Commit 223192a

Browse files
flichtenheldcron2
authored andcommitted
schedule: Rework documentation for schedule_add_entry
The previous documentation was very misleading and made it hard to understand how the sigma parameter is used. Rewrite it so that it better reflects the actual implementation. Change-Id: Idd79f7cbd38e8b0831f15866339c3677a367cd49 Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1439 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg35070.html Signed-off-by: Gert Doering <[email protected]>
1 parent 2a9c8a8 commit 223192a

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

src/openvpn/schedule.h

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,26 @@ void schedule_remove_node(struct schedule *s, struct schedule_entry *e);
8181

8282
/* Public inline functions */
8383

84-
/*
85-
* Add a struct schedule_entry (whose storage is managed by
86-
* caller) to the btree. tv signifies the wakeup time for
87-
* a future event. sigma is a time interval measured
88-
* in microseconds -- the event window being represented
89-
* starts at (tv - sigma) and ends at (tv + sigma).
90-
* Event signaling can occur anywere within this interval.
91-
* Making the interval larger makes the scheduler more efficient,
92-
* while making it smaller results in more precise scheduling.
93-
* The caller should treat the passed struct schedule_entry as
94-
* an opaque object.
84+
/**
85+
* Add a struct schedule_entry to the scheduler btree or
86+
* update an existing entry with a new wakeup time.
87+
*
88+
* @p sigma is only used when the entry is already present
89+
* in the schedule. If the originally scheduled time and the new
90+
* time are within @p sigma microseconds of each other then the
91+
* entry is not rescheduled and will occur at the original time.
92+
* When adding a new entry @p sigma will be ignored.
93+
*
94+
* @param s scheduler tree
95+
* @param e entry to add to the schedule
96+
* @param tv wakeup time for the entry
97+
* @param sigma window size for the event in microseconds
98+
*
99+
* @note The caller should treat @p e as opaque data. Only
100+
* the scheduler functions should change the object. The
101+
* caller is expected to manage the memory for the object
102+
* and must only free it once it has been removed from the
103+
* schedule.
95104
*/
96105
static inline void
97106
schedule_add_entry(struct schedule *s, struct schedule_entry *e, const struct timeval *tv,

0 commit comments

Comments
 (0)