當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。