def put(self, iocb):
    'Add an IOCB to a queue.  This is usually called by the function\n        that filters requests and passes them out to the correct processing\n        thread.'
    if _debug:
        IOQueue._debug('put %r', iocb)
    if (iocb.ioState != PENDING):
        raise RuntimeError('invalid state transition')
    wasempty = (not self.notempty.isSet())
    priority = iocb.ioPriority
    item = (priority, iocb)
    self.queue.insert(bisect_left(self.queue, ((priority + 1),)), item)
    iocb.ioQueue = self
    self.notempty.set()
    return wasempty
Add an IOCB to a queue.  This is usually called by the function
that filters requests and passes them out to the correct processing
thread.
def put(self, iocb):
    'Add an IOCB to a queue.  This is usually called by the function\n        that filters requests and passes them out to the correct processing\n        thread.'
    if _debug:
        IOQueue._debug('put %r', iocb)
    if (iocb.ioState != PENDING):
        raise RuntimeError('invalid state transition')
    wasempty = (not self.notempty.isSet())
    priority = iocb.ioPriority
    item = (priority, iocb)
    self.queue.insert(bisect_left(self.queue, ((priority + 1),)), item)
    iocb.ioQueue = self
    self.notempty.set()
    return wasempty