libaio/__init__.py
def submit(self, block_list):
        """
        Submits transfers.

        block_list (list of AIOBlock)
            The IO blocks to hand off to kernel.

        Returns the number of successfully submitted blocks.
        """
        # io_submit ioctl will only return an error for issues with the first
        # transfer block. If there are issues with a later block, it will stop
        # submission and return the number of submitted blocks. So it is safe
        # to only update self._submitted once io_submit returned.
        submitted_count = libaio.io_submit(
            self._ctx,
            len(block_list),
            (libaio.iocb_p * len(block_list))(*[
                # pylint: disable=protected-access
                pointer(x._iocb)
                # pylint: enable=protected-access
                for x in block_list
            ]),
        )
        submitted = self._submitted
        for block in block_list[:submitted_count]:
            # pylint: disable=protected-access
            submitted[addressof(block._iocb)] = (block, block._getSubmissionState())
            # pylint: enable=protected-access
        return submitted_count
def submit(self, block_list):
        """
        Submits transfers.

        block_list (list of AIOBlock)
            The IO blocks to hand off to kernel.

        Returns the number of successfully submitted blocks.
        """
        # io_submit ioctl will only return an error for issues with the first
        # transfer block. If there are issues with a later block, it will stop
        # submission and return the number of submitted blocks. So it is safe
        # to only update self._submitted once io_submit returned.
        submitted_count = libaio.io_submit(
            self._ctx,
            len(block_list),
            (libaio.iocb_p * len(block_list))(*[
                # pylint: disable=protected-access
                pointer(x._iocb)
                # pylint: enable=protected-access
                for x in block_list
            ]),
        )
        submitted = self._submitted
        for block in block_list[:submitted_count]:
            # pylint: disable=protected-access
            submitted[addressof(block._iocb)] = (block, block._getSubmissionState())
            # pylint: enable=protected-access
        return submitted_count
Submits transfers.

        block_list (list of AIOBlock)
            The IO blocks to hand off to kernel.

        Returns the number of successfully submitted blocks.