Add more detailed comments

pull/15092/head
Yash Tibrewal 7 years ago
parent 905f0ca39e
commit 21e360382f
  1. 6
      src/core/lib/iomgr/ev_epoll1_linux.cc
  2. 6
      src/core/lib/iomgr/ev_posix.h

@ -309,7 +309,9 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
struct epoll_event ev;
ev.events = static_cast<uint32_t>(EPOLLIN | EPOLLOUT | EPOLLET);
/* Use the least significant bit of ev.data.ptr to store track_err. */
/* Use the least significant bit of ev.data.ptr to store track_err. We expect
* the addresses to be word aligned. We need to store track_err to avoid
* synchronization issues when accessing it after receiving an event. */
ev.data.ptr = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(new_fd) |
(track_err ? 1 : 0));
if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, fd, &ev) != 0) {
@ -626,7 +628,7 @@ static grpc_error* process_epoll_events(grpc_pollset* pollset) {
grpc_fd* fd = reinterpret_cast<grpc_fd*>(
reinterpret_cast<intptr_t>(data_ptr) & ~static_cast<intptr_t>(1));
bool track_err =
reinterpret_cast<intptr_t>(data_ptr) & ~static_cast<intptr_t>(1);
reinterpret_cast<intptr_t>(data_ptr) & static_cast<intptr_t>(1);
bool cancel = (ev->events & EPOLLHUP) != 0;
bool error = (ev->events & EPOLLERR) != 0;
bool read_ev = (ev->events & (EPOLLIN | EPOLLPRI)) != 0;

@ -86,7 +86,11 @@ void grpc_event_engine_shutdown(void);
/* Return the name of the poll strategy */
const char* grpc_get_poll_strategy_name();
/* Returns true if polling engine can track errors separately, false otherwise
/* Returns true if polling engine can track errors separately, false otherwise.
* If this is true, fd can be created with track_err set. After this, error
* events will be reported using fd_notify_on_error. If it is not set, errors
* will continue to be reported through fd_notify_on_read and
* fd_notify_on_write.
*/
bool grpc_event_engine_can_track_errors();

Loading…
Cancel
Save