c - Distinguishing file descriptor types in epoll -
i have network client library i'm putting reads/writes network sockets.
there single thread network i/o , responds requests exposed client api. client api requests popped off fifo queue.
in order thread @ request, when main loop blocked on epoll_wait thinking should use eventfd can add epoll_ctl.
so question how can distinguish between event pushed onto fifo queue , network i/o if epoll notifies epollin?
edit: should add not wanting store event fd in data member, rather use ptr member. suppose need store fd somewhere inside structure.
can check see if triggered event = event file descriptor , therefore read fifo well, , if it's not equal must network event? safe? or there best practice approach.
yes have compare file descriptors. example in manual page this.
Comments
Post a Comment