'Process all pending requests from the pipe, return
after no more events are immediately available. (non-blocking)
Returns the number of events processed.'

def processRequests(self):

    with self.processLock:
        if self.exited:
            self.debugMsg('        processRequests:    exited    already;    raise    ClosedError.')
            raise ClosedError()
        numProcessed = 0
        while self.conn.poll():
            try:
                self.handleRequest()
                numProcessed += 1
            except ClosedError:
                self.debugMsg('processRequests:    got    ClosedError    from    handleRequest;    setting    exited=True.')
                self.exited = True
                raise
            except:
                print ('Error    in    process    %s' % self.name)
                sys.excepthook(*sys.exc_info())
        if (numProcessed > 0):
            self.debugMsg('processRequests:    finished    %d    requests', numProcessed)
        return numProcessed
