jing guo jing guo - 1 year ago 91
C++ Question

python,epoll.register(fd, eventmask) only has two parameters, how could I to use event.data_ptr like c++?

I use python's epoll but it can't use event.data.ptr like in c++.

Sometimes I will register class A.fd and sometimes I will register class B.fd.

So, when

returned, how can I know whether
belongs to class A or B?

Answer Source

You can always maintain a separate map from fd to A or B. Then when an event gets triggered, lookup based on fd. Doesn't look like epoll has a richer interface, even in Python 3+

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download