#NEWLINE# def _poll( self , timeout = None ) : #NEWLINE# #INDENT# 'Override in order to handle events in a threadsafe manner.' #NEWLINE# if ( timeout is None ) : #NEWLINE# #INDENT# ms = UINT32_MAX #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( timeout < 0 ) : #NEWLINE# #INDENT# raise ValueError ( 'negative timeout' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ms = math . ceil ( ( timeout * 1000.0 ) ) #NEWLINE# if ( ms >= UINT32_MAX ) : #NEWLINE# #INDENT# raise ValueError ( 'timeout too big' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# with QtCore . QMutexLocker ( self . _lock ) : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# status = _overlapped . GetQueuedCompletionStatus ( self . _iocp , ms ) #NEWLINE# if ( f is None ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# ( err , transferred , key , address ) = status #NEWLINE# try : #NEWLINE# #INDENT# ( f , ov , obj , callback ) = self . _cache . pop ( address ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# if ( key not in ( 0 , _overlapped . INVALID_HANDLE_VALUE ) ) : #NEWLINE# #INDENT# _winapi . CloseHandle ( key ) #NEWLINE# #UNINDENT# ms = 0 #NEWLINE# continue #NEWLINE# #UNINDENT# if ( obj in self . _stopped_serving ) : #NEWLINE# #INDENT# f . cancel ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not f . done ( ) ) : #NEWLINE# #INDENT# self . __events . append ( ( f , callback , transferred , key , ov ) ) #NEWLINE# #UNINDENT# #UNINDENT# ms = 0