当前位置: 首页>>代码示例>>Python>>正文


Python select.KQ_EV_ADD属性代码示例

本文整理汇总了Python中select.KQ_EV_ADD属性的典型用法代码示例。如果您正苦于以下问题:Python select.KQ_EV_ADD属性的具体用法?Python select.KQ_EV_ADD怎么用?Python select.KQ_EV_ADD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在select的用法示例。


在下文中一共展示了select.KQ_EV_ADD属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: register

# 需要导入模块: import select [as 别名]
# 或者: from select import KQ_EV_ADD [as 别名]
def register(self, fileobj, events, data=None):
            key = super(KqueueSelector, self).register(fileobj, events, data)
            if events & EVENT_READ:
                kevent = select.kevent(key.fd,
                                       select.KQ_FILTER_READ,
                                       select.KQ_EV_ADD)

                _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)

            if events & EVENT_WRITE:
                kevent = select.kevent(key.fd,
                                       select.KQ_FILTER_WRITE,
                                       select.KQ_EV_ADD)

                _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)

            return key 
开发者ID:snowflakedb,项目名称:snowflake-connector-python,代码行数:19,代码来源:ssl_wrap_util.py

示例2: test_issue30058

# 需要导入模块: import select [as 别名]
# 或者: from select import KQ_EV_ADD [as 别名]
def test_issue30058(self):
        # changelist must be an iterable
        kq = select.kqueue()
        a, b = socket.socketpair()
        ev = select.kevent(a, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE)

        kq.control([ev], 0)
        # not a list
        kq.control((ev,), 0)
        # __len__ is not consistent with __iter__
        class BadList:
            def __len__(self):
                return 0
            def __iter__(self):
                for i in range(100):
                    yield ev
        kq.control(BadList(), 0)
        # doesn't have __len__
        kq.control(iter([ev]), 0)

        a.close()
        b.close()
        kq.close() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:test_kqueue.py

示例3: registerForEvents

# 需要导入模块: import select [as 别名]
# 或者: from select import KQ_EV_ADD [as 别名]
def registerForEvents(self, asyncSocket, readEvents, writeEvents):
    fileno = asyncSocket.fileno()
    if readEvents:
      readKE = select.kevent(ident = fileno,
                             filter = select.KQ_FILTER_READ,
                             flags = select.KQ_EV_ADD)
    else:
      readKE = select.kevent(ident = fileno,
                             filter = select.KQ_FILTER_READ,
                             flags = (select.KQ_EV_ADD | select.KQ_EV_DISABLE))
    if writeEvents:
      writeKE = select.kevent(ident = fileno,
                              filter = select.KQ_FILTER_WRITE,
                              flags = select.KQ_EV_ADD)
    else:
      writeKE = select.kevent(ident = fileno,
                              filter = select.KQ_FILTER_WRITE,
                              flags = (select.KQ_EV_ADD | select.KQ_EV_DISABLE))
    # Should be able to put readKE and writeKE in a list in
    # one call to kqueue.control, but this is broken due to Python issue 5910
    self.__kqueue.control([readKE], 0, 0)
    self.__kqueue.control([writeKE], 0, 0) 
开发者ID:ActiveState,项目名称:code,代码行数:24,代码来源:recipe-577662.py

示例4: register

# 需要导入模块: import select [as 别名]
# 或者: from select import KQ_EV_ADD [as 别名]
def register(self, fd, events):
        if fd in self._active:
            raise IOError("fd %s already registered" % fd)
        self._control(fd, events, select.KQ_EV_ADD)
        self._active[fd] = events 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:7,代码来源:kqueue.py

示例5: register

# 需要导入模块: import select [as 别名]
# 或者: from select import KQ_EV_ADD [as 别名]
def register(self, fileobj, events, data=None):
            key = super(KqueueSelector, self).register(fileobj, events, data)
            if events & EVENT_READ:
                kev = select.kevent(key.fd, select.KQ_FILTER_READ,
                                    select.KQ_EV_ADD)
                self._kqueue.control([kev], 0, 0)
            if events & EVENT_WRITE:
                kev = select.kevent(key.fd, select.KQ_FILTER_WRITE,
                                    select.KQ_EV_ADD)
                self._kqueue.control([kev], 0, 0)
            return key 
开发者ID:jpush,项目名称:jbox,代码行数:13,代码来源:selectors.py


注:本文中的select.KQ_EV_ADD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。