jing guo jing guo - 3 months ago 23
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?


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+