Commit 6645a704 authored by Denis Bilenko's avatar Denis Bilenko

rename core.read and core.write to core.read_event / core.write_event

parent 2d9f8d73
......@@ -265,14 +265,14 @@ cdef class event:
self.cancel()
cdef class read(event):
cdef class read_event(event):
def __init__(self, int handle, callback, timeout=-1, arg=None):
event.__init__(self, EV_READ, handle, callback, arg)
self.add(timeout)
cdef class write(event):
cdef class write_event(event):
def __init__(self, int handle, callback, timeout=-1, arg=None):
event.__init__(self, EV_WRITE, handle, callback, arg)
......
......@@ -14,6 +14,7 @@ def get_fileno(obj):
def select(read_list, write_list, error_list, timeout=None):
# QQQ error_list is ignored
hub = get_hub()
current = getcurrent()
assert hub is not current, 'do not call blocking functions from the mainloop'
......@@ -28,9 +29,9 @@ def select(read_list, write_list, error_list, timeout=None):
current.switch(([], [], []))
for r in read_list:
allevents.append(core.read(get_fileno(r), callback, arg=r))
allevents.append(core.read_event(get_fileno(r), callback, arg=r))
for w in write_list:
allevents.append(core.write(get_fileno(r), callback, arg=w))
allevents.append(core.write_event(get_fileno(r), callback, arg=w))
timeout = Timeout(timeout)
try:
......
......@@ -51,7 +51,7 @@ def _wait_helper(ev, evtype):
def wait_reader(fileno, timeout=-1, timeout_exc=_socket.timeout):
evt = core.read(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc))
evt = core.read_event(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc))
try:
switch_result = get_hub().switch()
assert evt is switch_result, 'Invalid switch into wait_reader(): %r' % (switch_result, )
......@@ -60,7 +60,7 @@ def wait_reader(fileno, timeout=-1, timeout_exc=_socket.timeout):
def wait_writer(fileno, timeout=-1, timeout_exc=_socket.timeout):
evt = core.write(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc))
evt = core.write_event(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc))
try:
switch_result = get_hub().switch()
assert evt is switch_result, 'Invalid switch into wait_writer(): %r' % (switch_result, )
......
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