Commit 3195b00d authored by Denis Bilenko's avatar Denis Bilenko

core.event: pass (event, evtyoe) to callback instead of (event, fd, evtype)

fd is available as event.fd
parent a48ceb12
...@@ -108,7 +108,7 @@ EV_PERSIST = 0x10 ...@@ -108,7 +108,7 @@ EV_PERSIST = 0x10
cdef void __event_handler(int fd, short evtype, void *arg) with gil: cdef void __event_handler(int fd, short evtype, void *arg) with gil:
cdef event ev = <event>arg cdef event ev = <event>arg
try: try:
ev._callback(ev, fd, evtype) ev._callback(ev, evtype)
except: except:
traceback.print_exc() traceback.print_exc()
try: try:
......
...@@ -227,7 +227,7 @@ class DispatchExit(Exception): ...@@ -227,7 +227,7 @@ class DispatchExit(Exception):
pass pass
def _wait_helper(ev, fd, evtype): def _wait_helper(ev, evtype):
current, timeout_exc = ev.arg current, timeout_exc = ev.arg
if evtype & core.EV_TIMEOUT: if evtype & core.EV_TIMEOUT:
current.throw(timeout_exc) current.throw(timeout_exc)
......
...@@ -18,7 +18,7 @@ def select(read_list, write_list, error_list, t=None): ...@@ -18,7 +18,7 @@ def select(read_list, write_list, error_list, t=None):
assert hub.greenlet is not current, 'do not call blocking functions from the mainloop' assert hub.greenlet is not current, 'do not call blocking functions from the mainloop'
allevents = [] allevents = []
def callback(ev, fd, evtype): def callback(ev, evtype):
if evtype & core.EV_READ: if evtype & core.EV_READ:
current.switch(([ev.arg], [], [])) current.switch(([ev.arg], [], []))
elif evtype & core.EV_WRITE: elif evtype & core.EV_WRITE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment