Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 7cbedfb

Browse files
tli2apavlo
authored andcommitted
Address code review comments
1 parent 8a37723 commit 7cbedfb

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/include/network/notifiable_task.h

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,24 @@ class NotifiableTask {
9292

9393
/**
9494
* @brief Register an event with the event base associated with this
95-
notifiable task.
95+
* notifiable task.
9696
*
9797
* After registration, the event firing will result in the callback registered
98-
executing on
99-
* the thread this task is running on. Certain events has the same life cycle
100-
as the
101-
* task itself, in which case it is safe to ignore the return value and have
102-
these events
103-
* be freed on destruction of the task. However, if this is not the case, the
104-
caller will
105-
* need to save the return value and manually unregister the event with the
106-
task.
107-
*
108-
* @see UnregisterEvent()
98+
* executing on the thread this task is running on. Certain events has the
99+
* same life cycle as the task itself, in which case it is safe to ignore the
100+
* return value and have these events be freed on destruction of the task.
101+
* However, if this is not the case, the caller will need to save the return
102+
* value and manually unregister the event with the task.
103+
* @see UnregisterEvent().
109104
*
110105
* @param fd the file descriptor or signal to be monitored, or -1. (if manual
111-
or time-based)
106+
* or time-based)
112107
* @param flags desired events to monitor: bitfield of EV_READ, EV_WRITE,
113-
EV_SIGNAL, EV_PERSIST, EV_ET.
108+
* EV_SIGNAL, EV_PERSIST, EV_ET.
114109
* @param callback callback function to be invoked when the event happens
115110
* @param arg an argument to be passed to the callback function
116111
* @param timeout the maximum amount of time to wait for an event, defaults to
117-
null which will wait forever
112+
* null which will wait forever
118113
* @return pointer to the allocated event.
119114
*/
120115
struct event *RegisterEvent(int fd, short flags, event_callback_fn callback,
@@ -176,7 +171,9 @@ class NotifiableTask {
176171
}
177172

178173
// TODO(tianyu): The original network code seems to do this as an
179-
// optimization. I am leaving this out until we get numbers
174+
// optimization. Specifically it avoids new memory allocation by reusing
175+
// an existing event. I am leaving this out until we get numbers.
176+
180177
// void UpdateEvent(struct event *event, int fd, short flags,
181178
// event_callback_fn callback, void *arg,
182179
// const struct timeval *timeout = nullptr) {

0 commit comments

Comments
 (0)