client.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:python-wayland 作者: sde1000 项目源码 文件源码
def flush(self):
        """Send buffered requests to the display server.

        Will send as many requests as possible to the display server.
        Will not block; if sendmsg() would block, will leave events in
        the queue.

        Returns True if the queue was emptied.
        """
        while self._send_queue:
            b, fds = self._send_queue.pop(0)
            try:
                self._f.sendmsg([b], [(socket.SOL_SOCKET, socket.SCM_RIGHTS,
                                       array.array("i", fds))])
                for fd in fds:
                    os.close(fd)
            except socket.error as e:
                if socket.errno == 11:
                    # Would block.  Return the data to the head of the queue
                    # and try again later!
                    self.log.debug("flush would block; returning data to queue")
                    self._send_queue.insert(0, (b, fds))
                    return
                raise
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号