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


Python forking.close方法代碼示例

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


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

示例1: Pipe

# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import close [as 別名]
def Pipe(duplex=True):
        '''
        Returns pair of connection objects at either end of a pipe
        '''
        if duplex:
            s1, s2 = socket.socketpair()
            s1.setblocking(True)
            s2.setblocking(True)
            c1 = _multiprocessing.Connection(os.dup(s1.fileno()))
            c2 = _multiprocessing.Connection(os.dup(s2.fileno()))
            s1.close()
            s2.close()
        else:
            fd1, fd2 = os.pipe()
            c1 = _multiprocessing.Connection(fd1, writable=False)
            c2 = _multiprocessing.Connection(fd2, readable=False)

        return c1, c2 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:20,代碼來源:connection.py

示例2: __init__

# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import close [as 別名]
def __init__(self, address, family, backlog=1):
        self._socket = socket.socket(getattr(socket, family))
        try:
            self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            self._socket.setblocking(True)
            self._socket.bind(address)
            self._socket.listen(backlog)
            self._address = self._socket.getsockname()
        except socket.error:
            self._socket.close()
            raise
        self._family = family
        self._last_accepted = None

        if family == 'AF_UNIX':
            self._unlink = Finalize(
                self, os.unlink, args=(address,), exitpriority=0
                )
        else:
            self._unlink = None 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:22,代碼來源:connection.py

示例3: close

# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import close [as 別名]
def close(self):
        '''
        Close the bound socket or named pipe of `self`.
        '''
        return self._listener.close() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:7,代碼來源:connection.py

示例4: accept

# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import close [as 別名]
def accept(self):
        while True:
            try:
                s, self._last_accepted = self._socket.accept()
            except socket.error as e:
                if e.args[0] != errno.EINTR:
                    raise
            else:
                break
        s.setblocking(True)
        fd = duplicate(s.fileno())
        conn = _multiprocessing.Connection(fd)
        s.close()
        return conn 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:16,代碼來源:connection.py

示例5: _finalize_pipe_listener

# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import close [as 別名]
def _finalize_pipe_listener(queue, address):
            sub_debug('closing listener with address=%r', address)
            for handle in queue:
                close(handle) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:6,代碼來源:connection.py

示例6: accept

# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import close [as 別名]
def accept(self):
        s, self._last_accepted = self._socket.accept()
        s.setblocking(True)
        fd = duplicate(s.fileno())
        conn = _multiprocessing.Connection(fd)
        s.close()
        return conn 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:9,代碼來源:connection.py


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