Ticket #3718: waker.patch

File waker.patch, 1.1 KB (added by sanxiyn, 6 years ago)
  • twisted/internet/posixbase.py

     
    5353        win32process = None 
    5454 
    5555 
    56 class _Win32Waker(log.Logger, styles.Ephemeral): 
     56class _SocketWaker(log.Logger, styles.Ephemeral): 
    5757    """I am a workaround for the lack of pipes on win32. 
    5858 
    5959    I am a pair of connected sockets which can wake up the main loop 
     
    101101        self.w.close() 
    102102 
    103103 
    104 class _UnixWaker(log.Logger, styles.Ephemeral): 
     104class _PipeWaker(log.Logger, styles.Ephemeral): 
    105105    """This class provides a simple interface to wake up the event loop. 
    106106 
    107107    This is used by threads or signals to wake up the event loop. 
     
    152152        del self.i, self.o 
    153153 
    154154 
    155 if platformType == 'posix': 
    156     _Waker = _UnixWaker 
    157 elif platformType == 'win32': 
    158     _Waker = _Win32Waker 
     155if hasattr(os, 'pipe'): 
     156    _Waker = _PipeWaker 
     157else: 
     158    _Waker = _SocketWaker 
    159159 
    160160 
    161161class PosixReactorBase(_SignalReactorMixin, ReactorBase):