當前位置: 首頁>>代碼示例>>Python>>正文


Python _compat.InterruptedError方法代碼示例

本文整理匯總了Python中gunicorn._compat.InterruptedError方法的典型用法代碼示例。如果您正苦於以下問題:Python _compat.InterruptedError方法的具體用法?Python _compat.InterruptedError怎麽用?Python _compat.InterruptedError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gunicorn._compat的用法示例。


在下文中一共展示了_compat.InterruptedError方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: select

# 需要導入模塊: from gunicorn import _compat [as 別名]
# 或者: from gunicorn._compat import InterruptedError [as 別名]
def select(self, timeout=None):
        timeout = None if timeout is None else max(timeout, 0)
        ready = []
        try:
            r, w, _ = wrap_error(self._select,
                                 self._readers, self._writers, [], timeout)
        except InterruptedError:
            return ready
        r = set(r)
        w = set(w)
        for fd in r | w:
            events = 0
            if fd in r:
                events |= EVENT_READ
            if fd in w:
                events |= EVENT_WRITE

            key = self._key_from_fd(fd)
            if key:
                ready.append((key, events & key.events))
        return ready 
開發者ID:RoseOu,項目名稱:flasky,代碼行數:23,代碼來源:selectors.py

示例2: select

# 需要導入模塊: from gunicorn import _compat [as 別名]
# 或者: from gunicorn._compat import InterruptedError [as 別名]
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # poll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = int(math.ceil(timeout * 1e3))
            ready = []
            try:
                fd_event_list = wrap_error(self._poll.poll, timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready 
開發者ID:Jeremy-Friedman,項目名稱:metrics,代碼行數:27,代碼來源:selectors.py


注:本文中的gunicorn._compat.InterruptedError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。