def _cffi_poll(zmq_pollitem_list, poller, timeout=-1):
    if zmq_version == 2:
        timeout = timeout * 1000
    items = ffi.new('zmq_pollitem_t[]', zmq_pollitem_list)
    list_length = ffi.cast('int', len(zmq_pollitem_list))
    c_timeout = ffi.cast('long', timeout)
    C.zmq_poll(items, list_length, c_timeout)
    result = []
    for index in range(len(items)):
        if items[index].revents > 0:
            if not items[index].socket == ffi.NULL:
                result.append((poller._sockets[items[index].socket],
                            items[index].revents))
            else:
                result.append((items[index].fd, items[index].revents))
    return result
dataset/ETHPy150Open felipecruz/zmqpy/zmqpy/zmqpy.py/_cffi_poll/original