本文整理匯總了Python中multiprocessing.forking.duplicate方法的典型用法代碼示例。如果您正苦於以下問題:Python forking.duplicate方法的具體用法?Python forking.duplicate怎麽用?Python forking.duplicate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類multiprocessing.forking
的用法示例。
在下文中一共展示了forking.duplicate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: send_handle
# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import duplicate [as 別名]
def send_handle(conn, handle, destination_pid):
process_handle = win32.OpenProcess(
win32.PROCESS_ALL_ACCESS, False, destination_pid
)
try:
new_handle = duplicate(handle, process_handle)
conn.send(new_handle)
finally:
close(process_handle)
示例2: reduce_handle
# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import duplicate [as 別名]
def reduce_handle(handle):
if Popen.thread_is_spawning():
return (None, Popen.duplicate_for_child(handle), True)
dup_handle = duplicate(handle)
_cache.add(dup_handle)
sub_debug('reducing handle %d', handle)
return (_get_listener().address, dup_handle, False)
示例3: accept
# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import duplicate [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
示例4: accept
# 需要導入模塊: from multiprocessing import forking [as 別名]
# 或者: from multiprocessing.forking import duplicate [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