@ -137,7 +137,7 @@ else:
if expires is not None :
if expires is not None :
current_time = monotonic ( )
current_time = monotonic ( )
if current_time > expires :
if current_time > expires :
raise OSError ( errno =errno .ETIMEDOUT )
raise OSError ( errno .ETIMEDOUT )
if recalc_timeout :
if recalc_timeout :
if " timeout " in kwargs :
if " timeout " in kwargs :
kwargs [ " timeout " ] = expires - current_time
kwargs [ " timeout " ] = expires - current_time
@ -342,7 +342,7 @@ if hasattr(select, "select"):
timeout = None if timeout is None else max ( timeout , 0.0 )
timeout = None if timeout is None else max ( timeout , 0.0 )
ready = [ ]
ready = [ ]
r , w , _ = _syscall_wrapper ( self . _select , True , self . _readers ,
r , w , _ = _syscall_wrapper ( self . _select , True , self . _readers ,
self . _writers , timeout )
self . _writers , timeout = timeout )
r = set ( r )
r = set ( r )
w = set ( w )
w = set ( w )
for fd in r | w :
for fd in r | w :
@ -563,14 +563,14 @@ if hasattr(select, "kqueue"):
select . KQ_FILTER_READ ,
select . KQ_FILTER_READ ,
select . KQ_EV_ADD )
select . KQ_EV_ADD )
_syscall_wrapper ( self . _ kqueue. control, False , [ kevent ] , 0 , 0 )
_syscall_wrapper ( self . _ wrap_ control, False , [ kevent ] , 0 , 0 )
if events & EVENT_WRITE :
if events & EVENT_WRITE :
kevent = select . kevent ( key . fd ,
kevent = select . kevent ( key . fd ,
select . KQ_FILTER_WRITE ,
select . KQ_FILTER_WRITE ,
select . KQ_EV_ADD )
select . KQ_EV_ADD )
_syscall_wrapper ( self . _ kqueue. control, False , [ kevent ] , 0 , 0 )
_syscall_wrapper ( self . _ wrap_ control, False , [ kevent ] , 0 , 0 )
return key
return key
@ -581,7 +581,7 @@ if hasattr(select, "kqueue"):
select . KQ_FILTER_READ ,
select . KQ_FILTER_READ ,
select . KQ_EV_DELETE )
select . KQ_EV_DELETE )
try :
try :
_syscall_wrapper ( self . _ kqueue. control, False , [ kevent ] , 0 , 0 )
_syscall_wrapper ( self . _ wrap_ control, False , [ kevent ] , 0 , 0 )
except SelectorError :
except SelectorError :
pass
pass
if key . events & EVENT_WRITE :
if key . events & EVENT_WRITE :
@ -589,7 +589,7 @@ if hasattr(select, "kqueue"):
select . KQ_FILTER_WRITE ,
select . KQ_FILTER_WRITE ,
select . KQ_EV_DELETE )
select . KQ_EV_DELETE )
try :
try :
_syscall_wrapper ( self . _ kqueue. control, False , [ kevent ] , 0 , 0 )
_syscall_wrapper ( self . _ wrap_ control, False , [ kevent ] , 0 , 0 )
except SelectorError :
except SelectorError :
pass
pass
@ -602,8 +602,8 @@ if hasattr(select, "kqueue"):
max_events = len ( self . _fd_to_key ) * 2
max_events = len ( self . _fd_to_key ) * 2
ready_fds = { }
ready_fds = { }
kevent_list = _syscall_wrapper ( self . _ kqueue. control, True ,
kevent_list = _syscall_wrapper ( self . _ wrap_ control, True ,
None , max_events , timeout )
None , max_events , timeout = timeout )
for kevent in kevent_list :
for kevent in kevent_list :
fd = kevent . ident
fd = kevent . ident
@ -628,6 +628,9 @@ if hasattr(select, "kqueue"):
self . _kqueue . close ( )
self . _kqueue . close ( )
super ( KqueueSelector , self ) . close ( )
super ( KqueueSelector , self ) . close ( )
def _wrap_control ( self , changelist , max_events , timeout ) :
return self . _kqueue . control ( changelist , max_events , timeout )
__all__ . append ( ' KqueueSelector ' )
__all__ . append ( ' KqueueSelector ' )